Is there a way to set default reactable table options e.g. (compact = T and striped = T)
throughout instead of copy/pasting the same options for each reactable table?
It looks like you can set the default theme using options(reactable.theme = reactableTheme())
, but not sure about the above options e.g. (compact = T and striped = T)
.
A workaround would be to set the options and then define your own table-making function that calls those preset options:
options(reactable.compact = T,
reactable.searchable = T,
reactable.bordered = T,
reactable.striped = T,
reactable.highlight = T)
create_table <- \(data){
data_react <- reactable(
data,
bordered = getOption("reactable.bordered"),
compact = getOption("reactable.compact"),
searchable = getOption("reactable.searchable"),
striped = getOption("reactable.striped"),
highlight = getOption("reactable.highlight")
)
return(data_react)
}
create_table(data = df1)
You can reuse the function as you please. Hope this helps!