actions_block.Rd
A block that is used to hold interactive elements.
actions_block(elements, id = NULL)
elements | An array of interactive element objects: buttons, select menus, overflow menus, or date pickers. There is a maximum of 5 elements in each action block. |
---|---|
id | character, A string acting as a unique identifier for a block. Default: NULL |
actions_block class
Available in surfaces: Modals, Messages, Home tabs
Other layout:
as.blocks()
,
context_block()
,
divider_block()
,
file_block()
,
image_block()
,
input_block()
,
section_block()
,
wrap_blocks()
# An actions block with a select menu and a button: actions_block( id = 'actions1', elements = wrap_blocks( select_menu( placeholder = 'Which witch is the witchiest witch?', id = 'select_2', options = as.blocks( lapply(c('Matilda','Glinda','Granny Weatherwax','Hermione'), FUN = function(x){ block_option( text = x, value = gsub('\\s','',tolower(x)) ) }) ) ), button_element( text = 'Cancel', value = 'cancel', id = 'button_1' ) ) )#> { #> "type": "actions", #> "elements": [ #> { #> "type": "static_select", #> "action_id": "select_2", #> "placeholder": { #> "type": "plain_text", #> "text": "Which witch is the witchiest witch?" #> }, #> "options": [ #> { #> "text": { #> "type": "plain_text", #> "text": "Matilda" #> }, #> "value": "matilda" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "Glinda" #> }, #> "value": "glinda" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "Granny Weatherwax" #> }, #> "value": "grannyweatherwax" #> }, #> { #> "text": { #> "type": "plain_text", #> "text": "Hermione" #> }, #> "value": "hermione" #> } #> ] #> }, #> { #> "type": "button", #> "text": { #> "type": "plain_text", #> "text": "Cancel" #> }, #> "action_id": "button_1", #> "value": "cancel" #> } #> ], #> "block_id": "actions1" #> }# An actions block with a datepicker, an overflow, and a button: actions_block( id = 'actionblock789', elements = wrap_blocks( datepicker_element( id = 'datepicker123', initial_date = '1990-04-28', placeholder = 'Select a date' ), overflow_menu( id = 'overflow', options = as.blocks( lapply(sprintf('value-%d',1:4),block_option, text = '*this is plain_text text*') ) ), button_element( text = 'Click Me', value = 'click_me_123', id = 'button' ) ) )#> { #> "type": "actions", #> "elements": [ #> { #> "type": "datepicker", #> "placeholder": { #> "type": "plain_text", #> "text": "Select a date" #> }, #> "action_id": "datepicker123", #> "initial_date": "1990-04-28" #> }, #> { #> "type": "overflow", #> "action_id": "overflow", #> "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" #> } #> ] #> }, #> { #> "type": "button", #> "text": { #> "type": "plain_text", #> "text": "Click Me" #> }, #> "action_id": "button", #> "value": "click_me_123" #> } #> ], #> "block_id": "actionblock789" #> }