button_element: Button element

View source: R/elements.R

button_elementR Documentation

Button element

Description

An interactive component that inserts a button. The button can be a trigger for anything from opening a simple link to starting a complex workflow.

Usage

button_element(
  id,
  text,
  value = NULL,
  url = NULL,
  style = NULL,
  confirm = NULL
)

Arguments

id

character, An identifier for this action.

text

character, text of the button

value

The value to send along with the interaction payload. Default: NULL

url

character, A URL to load in the user's browser when the button is clicked. Default: NULL

style

Decorates buttons with alternative visual color schemes, Default: NULL

confirm

block_confirm, defines an optional confirmation dialog after the button is clicked. Default: NULL

Details

  • Works with block types: Section, Actions

  • primary gives buttons a green outline and text, ideal for affirmation or confirmation actions.

  • primary should only be used for one button within a set.

  • danger gives buttons a red outline and text, and should be used when the action is destructive.

  • Use danger even more sparingly than primary.

  • If you don't include this field, the default button style will be used.

Value

block element class

See Also

Other elements: checkbox_element(), datepicker_element(), image_element(), overflow_menu(), plaintext_element(), radiobuttons_element(), select_menu(), select_type_menu()

Examples

# A regular interactive button:
button_element(text = 'Click Me', value = 'click_me_123', id = 'button')

# A button with a primary style attribute:
button_element(text = 'Click Me', value = 'click_me_123', id = 'button',style = 'primary')

# A link button:

button_element(text = 'Link Button', url = 'https://api.slack.com/block-kit', id = 'button')


yonicd/slackblocks documentation built on March 2, 2023, 6:53 a.m.