Provides a way to group options in a select menu or multi-select menu.

block_option_groups(opts)

Arguments

opts

list, A named list of option objects that belong to this specific group. Maximum of 100 items.

Value

block_option_groups class

Details

if the input list is not named a templated name will be given in the form 'Group 01', 'Group 02', ...

See also

Other compositions: block_confirm(), block_option(), block_text()

Examples

block_option_groups( list( 'Group 1' = list( block_option(text = '*this is plain_text text*',value = 'value-0'), block_option(text = '*this is plain_text text*',value = 'value-1'), block_option(text = '*this is plain_text text*',value = 'value-2') ), 'Group 2' = list( block_option(text = '*this is plain_text text*',value = 'value-3') ) ) )
#> { #> "option_groups": [ #> { #> "label": { #> "type": "plain_text", #> "text": "Group 1" #> }, #> "options": [ #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-0" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-1" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-2" #> } #> ] #> }, #> { #> "label": { #> "type": "plain_text", #> "text": "Group 2" #> }, #> "options": [ #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-3" #> } #> ] #> } #> ] #> }
block_option_groups( list( list( block_option(text = '*this is plain_text text*',value = 'value-0'), block_option(text = '*this is plain_text text*',value = 'value-1'), block_option(text = '*this is plain_text text*',value = 'value-2') ), list( block_option(text = '*this is plain_text text*',value = 'value-3') ) ) )
#> { #> "option_groups": [ #> { #> "label": { #> "type": "plain_text", #> "text": "Group 01" #> }, #> "options": [ #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-0" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-1" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-2" #> } #> ] #> }, #> { #> "label": { #> "type": "plain_text", #> "text": "Group 02" #> }, #> "options": [ #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-3" #> } #> ] #> } #> ] #> }