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.
Fields
typestring
Always `button`.
stringtextPlainTextElement
The button's label. Truncates around 30 characters. Maximum length is 75 characters.
PlainTextElementaction_id?string
Identifies this action in the interaction payload. Must be unique within the block. Maximum length is 255 characters.
stringvalue?string
Sent back in the interaction payload when the button is clicked. Maximum length is 2000 characters.
stringurl?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.
stringstyle?"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.
"primary" | "danger"accessibility_label?string
Read by screen readers instead of `text`. Maximum length is 75 characters.
stringconfirm?ConfirmationDialog
Shows a confirmation dialog before the click is dispatched. See Confirmation dialogs.
ConfirmationDialogExamples
Default, primary and danger styles
Link button
A url button still fires a block_actions payload; the browser navigation is a side effect the
component performs in addition to dispatching.
As a section accessory
A button can sit to the right of a section’s text instead of inside an actions block.
With a confirmation dialog
Add confirm to make a destructive action ask first. See
Confirmation dialogs for the full object shape.
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).
Related
Elements overview
Where each element can live, and how action_id and block_id fit together.
Confirmation dialogs
Add a confirm step to any element with the confirm object.
Overflow menu
A kebab menu of up to 5 actions, for when buttons would crowd a row.
Icon button
A compact, icon-only button for a context_actions row.