bs_vars_table: Bootstrap table variables

Description Usage Arguments Value Examples

View source: R/vars-bootstrap.R

Description

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.

Usage

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
bs_vars_table(
  bg_accent = "lightblue",
  bg_hover = "firebrick"
)


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

fresh documentation built on July 2, 2020, 1:59 a.m.