bs_table {bsTools}R Documentation

Create a HTML table configured with Bootstrap classes

Description

Create a HTML table configured with Bootstrap classes

Usage

bs_table(
  x = list(),
  headers = NULL,
  table_class = "table",
  row_class = "table",
  cell_class = "table",
  responsive = FALSE,
  responsive_breakpoint = NULL,
  thead_class = NULL,
  tbody_class = NULL,
  striped = FALSE,
  hoverable = FALSE,
  bordered = FALSE,
  border_theme = NULL,
  borderless = FALSE
)

Arguments

x

A list with entries of equal length (use as.list(dataframe) to convert a data frame to a list).

headers

A vector of names to use as table headers instead of the list names (or 1, 2, 3, etc. if list is not named).

table_class

A string, the class of the table tag.

row_class

A string, the class of the tr tag.

cell_class

A string, the class of the th/td tag.

responsive

TRUE/FALSE, if TRUE, wraps the table in a div with class "table-responsive".

responsive_breakpoint

A string, gets appended to class "table-responsive-" in a div wrapping the table. One of "sm", "md", "lg", "xl", "xxl".

thead_class

A string, the class of the thead tag.

tbody_class

A string, the class of the tbody tag.

striped

TRUE/FALSE, if TRUE, adds "table-striped" to the table class.

hoverable

TRUE/FALSE, if TRUE, adds "table-hover" to the table class.

bordered

TRUE/FALSE, if TRUE, adds "table-bordered" to the table class.

border_theme

A string, one of the Bootstrap color themes (ex. "primary", "secondary", "warning", etc.).

borderless

TRUE/FALSE, if TRUE (and bordered is FALSE), adds "table-borderless" to the table class.

Value

A string of HTML.

Examples

bs_table(
x = list(
col1 = c(1, 2, 3, 4, 5),
col2 = c("a", "b", "c", "d", "e"),
col3 = c(1, 2, 3, 4, 5),
col4 = c("test", "test", "test", "test", "test")
),
headers = c("First", "Second", "Third", "Fourth"),
table_class = "table table-primary",
row_class = "table table-primary",
cell_class = "table table-primary"
)

[Package bsTools version 0.1.0 Index]