Skip to contents

User settings at the board level are managed by a board_options object. This can be constructed via new_board_options() and in case the set of user options is to be extended, the constructor is designed with sub-classing in mind. Consequently, the associated validator validate_board_options() is available as S3 generic. Inheritance checking is available as is_board_options() and coercion as as_board_options(). The currently set options for a board object can be retrieved with board_options() and option names are available as list_board_options(), which is short for names(board_options(.)). Finally, in order to extract the value of a specific option, board_option() can be used.

Usage

board_options(x)

new_board_options(
  board_name = "Board",
  n_rows = blockr_option("n_rows", 50L),
  page_size = blockr_option("page_size", 5L),
  filter_rows = blockr_option("filter_rows", FALSE),
  dark_mode = blockr_option("dark_mode", NULL),
  thematic = blockr_option("thematic", NULL),
  ...,
  class = character()
)

is_board_options(x)

as_board_options(x)

# S3 method for class 'board_options'
as_board_options(x)

# Default S3 method
as_board_options(x)

validate_board_options(x)

# S3 method for class 'board_options'
validate_board_options(x)

list_board_options(x)

board_option(opt, x)

get_board_option_value(opt, session = getDefaultReactiveDomain())

get_board_option_or_default(opt, session = getDefaultReactiveDomain())

Arguments

x

Board options object

board_name

String valued board name

n_rows, page_size

Number of rows and page size to show for tabular block previews

filter_rows

Enable filtering of rows in tabular block previews

dark_mode

Toggle between dark and light modes

thematic

Enable auto-theming for plots via

...

Further options

class

Optional sub-class

opt

Board option

session

Shiny session

Value

All of new_board_options(), as_board_options() and board_options() return a board_options object, as does the validator validate_board_options(), which is typically called for side effects of throwing errors is validation does not pass. Inheritance checking as is_board_options() returns a scalar logical, while list_board_options() returns a character vector of option names. Finally, board_option() returns the current value for a specific board option, which in principle may be any R object, but typically we have values such as strings or scalar integers and logicals.

Examples

opt <- new_board_options()

is_board_options(opt)
#> [1] TRUE
list_board_options(opt)
#> [1] "board_name"  "n_rows"      "page_size"   "filter_rows" "dark_mode"  
#> [6] "thematic"   

board_option("page_size", opt)
#> [1] 5