Skip to content
Block Kit for React
Esc
↑↓navigate↵open⌘Jpreview
On this page

Button

A clickable button, Slack's most common interactive element.

button is a clickable control that dispatches a block_actions payload when clicked. It can also carry a url to open a link, or a confirm object to ask before it fires.

Your AppAPP
onActionInteract with the preview.

Fields

PropType
typestring

Always `button`.

Typestring
textPlainTextElement

The button's label. Truncates around 30 characters. Maximum length is 75 characters.

TypePlainTextElement
action_id?string

Identifies this action in the interaction payload. Must be unique within the block. Maximum length is 255 characters.

Typestring
value?string

Sent back in the interaction payload when the button is clicked. Maximum length is 2000 characters.

Typestring
url?string

A URL to open in a new tab when the button is clicked. Slack still sends the interaction payload; your app is expected to acknowledge it. Maximum length is 3000 characters.

Typestring
style?"primary" | "danger"

`primary` renders green, `danger` renders red. Omit for the default gray style. Use `primary` on at most one button in a set, and `danger` sparingly.

Type"primary" | "danger"
accessibility_label?string

Read by screen readers instead of `text`. Maximum length is 75 characters.

Typestring
confirm?ConfirmationDialog

Shows a confirmation dialog before the click is dispatched. See Confirmation dialogs.

TypeConfirmationDialog

Examples

Default, primary and danger styles

Your AppAPP

A url button still fires a block_actions payload; the browser navigation is a side effect the component performs in addition to dispatching.

Your AppAPP
This is a section block with a button.
onActionInteract with the preview.

As a section accessory

A button can sit to the right of a section’s text instead of inside an actions block.

Your AppAPP
This is a section block with a button.
onActionInteract with the preview.

With a confirmation dialog

Add confirm to make a destructive action ask first. See Confirmation dialogs for the full object shape.

Your AppAPP
onActionInteract with the preview.

Interactivity

Clicking a button (after any confirm dialog is accepted) calls onAction with a button action and, if url is set, opens it in a new tab:

{
  "type": "button",
  "action_id": "approve",
  "block_id": "approval",
  "action_ts": "1706000000.000100",
  "text": { "type": "plain_text", "text": "Approve", "emoji": true },
  "value": "approve_123",
  "style": "primary"
}

url and style are only included when the element itself sets them. A button doesn’t write to state.values: Slack only tracks state for elements that hold a value across interactions (selects, inputs, date pickers, and so on).

Was this page helpful?