{"id":13733840,"url":"https://github.com/kcuilla/reactablefmtr","last_synced_at":"2025-10-07T21:55:51.555Z","repository":{"id":38842460,"uuid":"336326609","full_name":"kcuilla/reactablefmtr","owner":"kcuilla","description":"Streamlined Table Styling and Formatting for Reactable","archived":false,"fork":false,"pushed_at":"2024-03-16T14:50:51.000Z","size":29020,"stargazers_count":208,"open_issues_count":38,"forks_count":27,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-12T22:48:21.968Z","etag":null,"topics":["customization","data-visualization","easy-to-use","r","r-package","reproducible","rstats","tables"],"latest_commit_sha":null,"homepage":"https://kcuilla.github.io/reactablefmtr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kcuilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-05T16:29:42.000Z","updated_at":"2024-11-07T18:44:31.000Z","dependencies_parsed_at":"2023-01-29T01:02:38.020Z","dependency_job_id":null,"html_url":"https://github.com/kcuilla/reactablefmtr","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcuilla%2Freactablefmtr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcuilla%2Freactablefmtr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcuilla%2Freactablefmtr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kcuilla%2Freactablefmtr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kcuilla","download_url":"https://codeload.github.com/kcuilla/reactablefmtr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224720750,"owners_count":17358476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["customization","data-visualization","easy-to-use","r","r-package","reproducible","rstats","tables"],"created_at":"2024-08-03T03:00:49.950Z","updated_at":"2025-10-07T21:55:51.548Z","avatar_url":"https://github.com/kcuilla.png","language":"R","readme":"## reactablefmtr \u003ca href='https://kcuilla.github.io/reactablefmtr/index.html'\u003e\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/logo.png\" align=\"right\" width=\"150\" height=\"185\"/\u003e\r\n\r\n\u003c!-- badges: start --\u003e\r\n[![CRAN Status](https://www.r-pkg.org/badges/version/reactablefmtr?color=blue)](https://cran.r-project.org/package=reactablefmtr?color=blue)\r\n[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/grand-total/reactablefmtr?color=brightgreen)](https://cranlogs.r-pkg.org/badges/grand-total/reactablefmtr?color=brightgreen)\r\n\u003c!-- badges: end --\u003e\r\n\r\nThe {reactablefmtr} package streamlines and enhances the styling and formatting of tables built with the {reactable} **R** package. The {reactablefmtr} package provides many conditional formatters that are highly customizable and easy to use.\r\n\r\n* **Conditionally format tables** with [color scales](https://kcuilla.github.io/reactablefmtr/articles/color_scales.html), [color tiles](https://kcuilla.github.io/reactablefmtr/articles/color_tiles.html), and [data bars](https://kcuilla.github.io/reactablefmtr/articles/data_bars.html). Assign icons from [Font Awesome](https://fontawesome.com/icons?d=gallery\u0026p=2) with [icon assign](https://kcuilla.github.io/reactablefmtr/articles/icon_assign.html) and [icon sets](https://kcuilla.github.io/reactablefmtr/articles/icon_sets.html).\r\n\r\n* **Interactive sparklines** that are highly [customizable](https://kcuilla.github.io/reactablefmtr/articles/sparklines.html) and available in line or bar format.\r\n  \r\n* **Custom table themes** that can [easily](https://kcuilla.github.io/reactablefmtr/articles/themes.html) be applied to any {reactablefmtr} or {reactable} table.\r\n  \r\n* **Embed images** directly from the web into your table.\r\n  \r\n* **Save tables** as static PNG files or as interactive HTML files.\r\n\r\nFor more examples, check out the [vignettes](https://kcuilla.github.io/reactablefmtr/articles/). To stay up to date with the latest upgrades to the development version, be sure to follow the package [news](https://kcuilla.github.io/reactablefmtr/news/index.html).\r\n\r\n## Installation\r\n\r\nThe {reactablefmtr} package is available from CRAN and can be installed with:\r\n\r\n```{r}\r\ninstall.packages(\"reactablefmtr\")\r\n```\r\n\r\nOr install the development version of {reactablefmtr} with:\r\n\r\n```{r}\r\nremotes::install_github(\"kcuilla/reactablefmtr\")\r\n```\r\n\r\n## Why reactablefmtr?\r\n\r\nThe {reactable} package allows for the creation of interactive data tables in R. However, styling tables within {reactable} requires a lot of code, can be difficult for many R users (due to the need to understand HTML and CSS), and not scalable. For example, here is the current method of creating bar charts within {reactable}:\r\n\r\n```{r}\r\nlibrary(reactable)\r\nlibrary(htmltools)\r\n\r\ndata \u003c- MASS::Cars93[20:49, c(\"Make\", \"MPG.city\", \"MPG.highway\")]\r\n\r\nbar_chart \u003c- function(label, width = \"100%\", height = \"16px\", fill = \"#15607A\", background = \"#EEEEEE\") {\r\n  bar \u003c- div(style = list(background = fill, width = width, height = height))\r\n  chart \u003c- div(style = list(flexGrow = 1, marginLeft = \"8px\", background = background), bar)\r\n  div(style = list(display = \"flex\", alignItems = \"center\"), label, chart)\r\n}\r\n\r\nreactable(\r\n  data,\r\n  columns = list(\r\n    MPG.city = colDef(align = \"left\", cell = function(value) {\r\n      width \u003c- paste0(value / max(data$MPG.city) * 100, \"%\")\r\n      bar_chart(value, width = width)\r\n    }),\r\n    MPG.highway = colDef(align = \"left\", cell = function(value) {\r\n      width \u003c- paste0(value / max(data$MPG.highway) * 100, \"%\")\r\n      bar_chart(value, width = width)\r\n    })\r\n  )\r\n)\r\n```\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/reactableexample2.gif\" align=\"center\" /\u003e\r\n\r\nThe {reactablefmtr} package presents a much simpler method of creating bar charts with the `data_bars()` function. In addition to needing far less code, there are also a multitude of customization options available to easily change the appearance of the bar charts, and as an added bonus, the bars animate on sort!\r\n\r\n```{r}\r\nlibrary(reactablefmtr)\r\n\r\nreactable(\r\n  data,\r\n  defaultColDef = colDef(\r\n    cell = data_bars(data, text_position = \"outside-base\")\r\n  )\r\n)\r\n```\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/reactablefmtrexample2.gif\" align=\"center\" /\u003e\r\n\r\n## Examples\r\n\r\n### Data Bars\r\n\r\nUse `data_bars()` to assign horizontal bars to each row. There are many ways to [customize](https://kcuilla.github.io/reactablefmtr/reference/data_bars.html) the look of `data_bars()`, including the alignment of the bars, the position of the text labels, and the option to add icons and images to the bars. See the [tutorial](https://kcuilla.github.io/reactablefmtr/articles/data_bars.html) for customization examples. \r\n\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/data_bars_animated_demo.gif\" align=\"center\" /\u003e\r\n\r\n### Sparklines\r\n\r\nUse `react_sparkline()` to create sparklines or `react_sparkbar()` to create sparkline bar charts. The sparklines are highly customizable and interactive. As you hover over each data point, the value will appear. The sparklines are imported from the [{dataui}](https://timelyportfolio.github.io/dataui/index.html) package, so this package will need to be downloaded from GitHub in order to use this feature.\r\n   \r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/sparklinesgif1.gif\" algin=\"center\"/\u003e\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/sparklinesgif2.gif\" algin=\"center\"/\u003e\r\n\r\n### Color Scales\r\n\r\nUse `color_scales()` to assign conditional colors to cells based on their relative values. The color of the text in the cells automatically adjusts based on the shade of the cell color, allowing the use of dark-colored palettes. See the [tutorial](https://kcuilla.github.io/reactablefmtr/articles/color_scales.html) for more examples.\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/colorscales_heatmap2.gif\" align=\"center\"/\u003e\r\n\r\n\r\n### Bubble Grids\r\n  \r\nBubble grid tables can be created using `bubble_grid()`. Bubbles can be shown as circles or squares using the `shape` parameter. To see how the example below was created, please check out the [bubble grids](https://kcuilla.github.io/reactablefmtr/articles/reactablefmtr_cookbook.html#adjust-size-of-bubbles) section in the {reactablefmtr} cookbook:\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/bubblegridexample.gif\" align=\"center\"/\u003e\r\n\r\n \r\n## Custom Themes\r\n\r\nWithin {reactablefmtr}, there are 24+ custom table themes. The themes include [bootstrap](https://bootswatch.com/) themes, themes inspired by news/sports sites such as The New York Times, FiveThirtyEight, and ESPN, as well as other custom themes that can only be found within {reactablefmtr}. The themes can be applied easily to tables by simply referencing the theme name. Additional customization options, such as changing the font size, font color, etc. are also [available](https://kcuilla.github.io/reactablefmtr/articles/themes.html).\r\n\r\nAn example of the fivethirtyeight() theme:\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/fivethirtyeightthemeexample.gif\" align=\"center\" /\u003e\r\n\r\n\r\n## Using with Crosstalk or Shiny\r\n\r\n{reactablefmtr} works well when linked to UI controls via [{crosstalk}](https://rstudio.github.io/crosstalk/using.html) or within a Shiny app. \r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/crosstalkexamplegif.gif\" align=\"center\" /\u003e\r\n\r\n\r\n## Add a Title, Subtitle, and Source\r\n\r\nTitles and subtitles can be easily placed above any {reactablefmtr} or {reactable} table with `add_title()` and `add_subtitle()`. Also have the option to include a source below a table with `add_source()`. Additional customization options such as changing the alignment, font size, font family, font style, and font color are available within each formatter.\r\n\r\n```{r}\r\nreactable(iris[10:29, ]) %\u003e%\r\n  add_title(\"This is a title\") %\u003e% \r\n  add_subtitle(\"This is a subtitle\") %\u003e% \r\n  add_source(\"This is a source\")\r\n```\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/README_add_title.png\" align=\"center\" /\u003e\r\n\r\n\r\n## Create Data Visualizations\r\n\r\nWho says {reactablefmtr} can just be used to make tables? You can create data visualizations like the one shown below. [Source code](https://github.com/kcuilla/Tidy-Tuesday/blob/main/2021_26/park_spending.R) \r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/kcuilla/reactablefmtr/main/man/figures/bloombergchartgif.gif\" align = \"center\" /\u003e\r\n\r\n\r\n## Save Static or Interactive Tables\r\n\r\n{reactablefmtr} or {reactable} tables can be saved directly to a file as a static PNG image or as an interactive HTML file with `save_reactable()`.\r\n\r\nSave as a PNG file:\r\n\r\n```{r}\r\nsave_reactable(table_name, \"table.png\")\r\n```\r\n\r\nSave as an HTML file:\r\n\r\n```{r}\r\nsave_reactable(table_name, \"table.html\")\r\n```\r\n\r\nIf custom CSS styling is applied to the table within an R Markdown document:\r\n\r\n```{r}\r\nsave_reactable(\"table_name.Rmd\", \"table.png\")\r\n```\r\n\r\nIf you prefer to use a pipe:\r\n\r\n```{r}\r\ntable_name %\u003e%\r\nsave_reactable(\"table.png\")\r\n```\r\n\r\n## Additional Resources\r\n  \r\nA presentation given to the SoCal R Users Group:\r\nhttps://rpubs.com/kcuilla/reactablefmtr-socal-presentation\r\n\r\n## Acknowledgments \u0026 Contributions\r\n\r\n* A huge thank you to Greg Lin for creating the amazing [{reactable}](https://glin.github.io/reactable/index.html) package! Without Greg, {reactablefmtr} simply would not exist! \r\n\r\n* Thank you to Kent Russell for putting together the wonderful [{dataui}](https://timelyportfolio.github.io/dataui/index.html) package and suggesting integrating the code with {reactablefmtr} to allow interactive sparkline customization in reactable tables.\r\n\r\n* Last but not least, thank you to those below who have contributed to the development and/or documentation of the package! [@yjunechoe](https://github.com/yjunechoe), [@shannonpileggi](https://github.com/shannonpileggi), [@TimTeaFan](https://github.com/TimTeaFan)\r\n\r\n","funding_links":[],"categories":["UI Components","R"],"sub_categories":["Table"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcuilla%2Freactablefmtr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkcuilla%2Freactablefmtr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkcuilla%2Freactablefmtr/lists"}