Skip to contents

This function allows you to define column widths for different attributes in a reactable table.

Usage

colDef_colWidth_robust(
  cols,
  minWidth = NA,
  maxWidth = NA,
  width = NA,
  wrap = F
)

Arguments

cols

A character vector specifying the attributes for which column widths are defined.

minWidth

Minimum width for the columns. Default is NA.

maxWidth

Maximum width for the columns. Default is NA.

width

Width for the columns. Default is NA.

wrap

Logical indicating whether to wrap text in the columns. Default is FALSE.

Value

A list of column definitions for the specified attributes, with width settings applied.

Examples


rownames_to_column("cars") %>%
  reactable(
    defaultColDef = colDef(footerStyle = list(fontWeight = "bold")),
    groupBy = "cars",
    columns = combined_named_lists(
      colDef_colWidth_robust(cols = c("cars", "mpg"), minWidth = 400)
      # ,colDef_hide(cols = c("vs", "am", "gear", "carb", "wt"))
    )
  )
#> Error in rownames_to_column("cars"): is.data.frame(df) is not TRUE