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
)

Arguments

cell_padding

Cell padding.

condensed_cell_padding

Cell padding when using condensed table.

bg

Background color.

bg_accent

Background color used in striped table.

bg_hover

Background color used when hovering the table with the mouse.

bg_active

Background color when row is selected.

border_color

Border color.

Value

a list that can be used in create_theme.

Examples


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)
}