Skip to contents

The colDef_sticky function generates column definitions with sticky behavior for a Reactable table. It creates column definitions based on provided column names and the side to which the columns should stick.

Usage

colDef_sticky(cols, side = "left")

Arguments

cols

A character vector specifying the column names for which the sticky column definitions are to be generated.

side

A character string specifying the side to which the columns should stick. Default is "left".

Value

A list of column definitions suitable for use in a Reactable table.

Examples

library(reactable)
library(dplyr)

mtcars %>%
  rownames_to_column("cars") %>%
  reactable(
    defaultColDef = colDef(footerStyle = list(fontWeight = "bold")),
    columns = combined_named_lists(
      colDef_sticky(cols = c("cars", "mpg"))
    )
  )
#> Error in map(item_list, names): could not find function "map"

# This example creates a Reactable table with sticky columns
# using the \code{colDef_sticky} function.