A select menu, just as with a standard HTML select tag, creates a drop down menu with a list of options for a user to choose. The select menu also includes type-ahead functionality, where a user can type a part or all of an option string to filter the list.

select_menu(
  id,
  placeholder,
  options,
  option_groups = NULL,
  initial_option = NULL,
  confirm = NULL,
  max_select_items = NULL
)

Arguments

id

character, an identifier for the action triggered when a menu option is selected.

placeholder

character, defines the placeholder text shown on the menu.

options

list, a list of option objects.

option_groups

a list of option group objects. Default: NULL

initial_option

a single option that exactly matches one of the options within options or option_groups, Default: NULL

confirm

A confirm object that defines an optional confirmation dialog that appears after a menu item is selected. Default: NULL

max_select_items

integer, Specifies the maximum number of items that can be selected in the menu, Default: NULL

Value

block menu class

Details

Works with block types: Section, Actions, Input

If options is specified, then option_groups should not be and vice versa.

See also

Examples

section_block( id = 'section678', text = 'Pick an item from the dropdown list', accessory = select_menu( id = 'text1234', placeholder = 'Select an item', options = as.blocks( lapply(sprintf('value-%d',1:4),block_option, text = '*this is plain_text text*') ) ) )
#> { #> "type": "section", #> "text": "Pick an item from the dropdown list", #> "block_id": "section678", #> "accessory": { #> "type": "static_select", #> "action_id": "text1234", #> "placeholder": { #> "type": "plain_text", #> "text": "Select an item" #> }, #> "options": [ #> { #> "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" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-3" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "*this is plain_text text*" #> }, #> "value": "value-4" #> } #> ] #> } #> }