New in v0.4.0
Static rendering is an optional feature that allows you to render tables to static HTML in R.
By default, tables are rendered completely in the user’s browser by
reactable() in R.
This means when you load a page, tables will be blank at first, and then appear a short time later as they get rendered. In extreme cases, it can take a noticeably long time for tables to appear, like with the heavy Examples without static rendering page.
- Better user experience in many cases, as tables appear immediately and don’t cause any layout shift on page load.
Note: Static rendering is currently experimental,
and is not supported for tables rendered via
reactableOutput() in Shiny. There are also other limitations and tradeoffs to
consider, and static rendering may not make sense for every table.
To use static rendering, ensure that the V8 package is installed first. V8 is not installed with reactable by default.
reactable(static = TRUE) to render a single
table to static HTML:
data <- MASS::Cars93[, c("Manufacturer", "Model", "Type", "Price")] reactable(data, defaultPageSize = 5, static = TRUE)
options(reactable.static = TRUE) to enable static
rendering for all tables:
The reactable package documentation uses static rendering in several articles, and provides alternate versions of these pages without static rendering for comparison:
Limitations and Tradeoffs
Although static rendering might seem useful to enable for all tables, there are some limitations and tradeoffs to consider, and it may not make sense to use for every table.
Static rendering isn’t supported for tables rendered via
reactableOutput()in Shiny. It is still supported for
reactable()tables specified in a Shiny app’s
Some features in reactable do not fully support static rendering yet:
enlocales. Formatting with other locales will still work in the browser, but tables may initially show data formatted in an
- Default expanded rows and row details with
reactable(defaultExpanded = TRUE)are not statically rendered.
HTML documents will be larger, which could affect users with slower download speeds. Static rendering is especially not recommended for unpaginated tables with a large number of rows.
document), you can defer rendering until the DOM is available to prevent rendering failures:
reactableTheme()may initially appear unstyled when rendered in pkgdown websites. Statically rendered theme styles are usually placed in the document
<head>to prevent problem, but pkgdown renders all user-specified
<head>content into the document body, which means tables will appear before browsers process the theme styles.