| dt2_theme | R Documentation |
Creates a theme object that can be passed to dt2() via the theme
parameter. Useful when you want the same look across many tables.
For quick one-off styling, you can also pass arguments directly to
dt2() (e.g., dt2(iris, striped = FALSE)).
dt2_theme(
preset = "default",
striped = NULL,
hover = NULL,
compact = NULL,
font_scale = NULL,
style = NULL,
button_class = NULL
)
preset |
A named preset to start from: |
striped |
Logical; alternate row colours. |
hover |
Logical; highlight rows on hover. |
compact |
Logical; reduce cell padding. |
font_scale |
Numeric; font-size multiplier (e.g., 0.85 = 85%). |
style |
Styling framework: |
button_class |
CSS class string for Buttons extension buttons.
Default: |
A dt2_theme object (a named list).
# Create and reuse
my_theme <- dt2_theme("clean", compact = TRUE)
dt2(iris, theme = my_theme)
dt2(mtcars, theme = my_theme)
# Custom button style
dt2_theme("default", button_class = "btn btn-sm btn-primary")
# Presets
dt2_theme("minimal")
dt2_theme("compact")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.