Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for reactablefmtr #32

Open
RoelVerbelen opened this issue Nov 25, 2024 · 2 comments
Open

Support for reactablefmtr #32

RoelVerbelen opened this issue Nov 25, 2024 · 2 comments

Comments

@RoelVerbelen
Copy link

Thanks for all the work, great to see reactable make its way to Python!

Are there any plans to bring over the flexible formatting extension package reactablefmtr by Kyle Cuilla as well?
https://kcuilla.github.io/reactablefmtr/index.html

@machow
Copy link
Owner

machow commented Nov 26, 2024

It looks like mostly htmltools, so I'm guessing it might also work in Great Tables / gt?! If someone wanted to take a crack at it, we'd gladly help them get off the ground. Otherwise, we might find our way to doing it at some point 😅.

I'd be curious to hear what functions you use most in reactablefmtr? 😁

@RoelVerbelen
Copy link
Author

Thanks @machow. I personally use the reactablefmtr::data_bars() the most to create tables like these:
image

Here's the partial code snippet for reference:

# Reactable table
  distr_all %>% 
    reactable::reactable(
      groupBy = "Variable",
      defaultExpanded = TRUE,
      searchable = TRUE,
      sortable = FALSE,
      resizable = TRUE,
      columns = list(
        All = reactable::colDef(
          align = "left",
          cell = reactablefmtr::data_bars(distr_all, 
                                          text_position = "inside-base", 
                                          number_fmt = scales::label_percent(trim = FALSE),
                                          min_value = 0,
                                          max_value = max(distr_all[, -(1:2)]),
                                          fill_color = "#F8B217",
                                          fill_opacity = 1,
                                          animation = "none")
        )
      ),
      defaultColDef = reactable::colDef(
        align = "left",
        cell = reactablefmtr::data_bars(distr_all, 
                                        text_position = "inside-base", 
                                        number_fmt = scales::label_percent(trim = FALSE),
                                        min_value = 0,
                                        max_value = max(distr_all[, -(1:2)]),
                                        brighten_text_color = "black",
                                        fill_color = "#00B0BD",
                                        fill_opacity = 0.5,
                                        animation = "none")
      )
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants