Those variables can be used to customize
table (produced ever by shiny::renderTable
or by shiny::renderDataTable
and DT equivalent)
in Bootstrap and Bootswatch themes.
bs_vars_table(
cell_padding = NULL,
condensed_cell_padding = NULL,
bg = NULL,
bg_accent = NULL,
bg_hover = NULL,
bg_active = NULL,
border_color = NULL
)
Cell padding.
Cell padding when using condensed table.
Background color.
Background color used in striped table.
Background color used when hovering the table with the mouse.
Background color when row is selected.
Border color.
a list
that can be used in create_theme
.
bs_vars_table(
bg_accent = "lightblue",
bg_hover = "firebrick"
)
#> $`table-bg-accent`
#> [1] "lightblue"
#>
#> $`table-bg-hover`
#> [1] "firebrick"
#>
#> attr(,"class")
#> [1] "fresh_sass_vars" "bootstrap_vars" "list"
if (interactive()) {
library(shiny)
library(fresh)
ui <- fluidPage(
use_theme(create_theme(
theme = "default",
bs_vars_table(
bg_accent = "lightblue",
bg_hover = "firebrick"
)
)),
tags$h1("Tables"),
fluidRow(
column(
width = 6,
tableOutput("table")
),
column(
width = 6,
dataTableOutput("datatable")
)
)
)
server <- function(input, output, session) {
output$table <- renderTable(
head(iris), striped = TRUE, hover = TRUE
)
output$datatable <- renderDataTable({
head(mtcars)
})
}
shinyApp(ui, server)
}