Use colGroup()
to create column groups in a table.
colGroup(
name = NULL,
columns = NULL,
header = NULL,
html = FALSE,
align = NULL,
headerVAlign = NULL,
sticky = NULL,
headerClass = NULL,
headerStyle = NULL
)
Column group header name.
Character vector of column names in the group.
Custom header renderer. An R function that takes the header value
as an argument, or a JS()
function that takes a column object and
table state object as arguments.
Render header content as HTML? Raw HTML strings are escaped by default.
Horizontal alignment of content in the column group header. One of
"left"
, "right"
, "center"
(the default).
Vertical alignment of content in the column group header. One of
"top"
(the default), "center"
, "bottom"
.
Make the column group sticky when scrolling horizontally? Either
"left"
or "right"
to make the column group stick to the left or right side.
If a column group is sticky, all columns in the group will automatically be made sticky.
Additional CSS classes to apply to the header.
Inline styles to apply to the header. A named list or character string.
Note that if headerStyle
is a named list, property names should be camelCased.
A column group definition object that can be used to create column
groups in reactable()
.
reactable(
iris,
columns = list(
Sepal.Length = colDef(name = "Length"),
Sepal.Width = colDef(name = "Width"),
Petal.Length = colDef(name = "Length"),
Petal.Width = colDef(name = "Width")
),
columnGroups = list(
colGroup(name = "Sepal", columns = c("Sepal.Length", "Sepal.Width")),
colGroup(name = "Petal", columns = c("Petal.Length", "Petal.Width"))
)
)
#> Error in x$width %||% settings$fig.width * settings$dpi: non-numeric argument to binary operator