bs_table {bsTools}R Documentation

Create a HTML table configured with Bootstrap classes

Description

Learn more at https://getbootstrap.com/docs/5.1/content/tables/.

Usage

bs_table(
  x,
  id,
  headers = NULL,
  table_attr = list(class = "table"),
  thead_attr = NULL,
  tbody_attr = NULL,
  tr_attr = NULL,
  th_attr = list(scope = "col"),
  td_attr = NULL,
  wrapper_attr = NULL
)

Arguments

x

A data frame or list with entries of equal length.

id

A string, the id for the table.

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_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::table.

thead_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::thead.

tbody_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::tbody.

tr_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::tr.

th_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::th.

td_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::td.

wrapper_attr

A named list or named vector, names are attribute names and values are attribute values. Passed to the attr parameter of html5::div wrapping html5::table.

Value

A string of HTML.

Examples

bs_table(
id = "t1",
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")
)
)

[Package bsTools version 1.0.5 Index]