Skip to main content

Button Actions and Interactions

Add interactivity to your cards with buttons and action handlers. The SDK automatically routes button clicks to your registered handlers.

Button Types

Action Button

Triggers a callback handler when clicked.
JSX Example:
Function Example:
Opens a URL when clicked (no callback handler).
Example:

Handling Button Clicks

Register handlers for button actions using the action ID:

Action Event

Handlers receive an ActionEvent with full context:

Using Button Values

Pass data through button clicks with the value field:

Catch-All Handler

Handle all button clicks with a single handler:

Actions Container

Buttons must be wrapped in an Actions container:
Example with mixed elements:

Updating Messages After Actions

Edit the message that contained the button:

Complete Example

Approval workflow with status updates:

Button Styles

Three visual styles are available:
  • primary - Blue/prominent (Slack: primary, Teams: accent)
  • danger - Red/destructive (Slack: danger, Teams: destructive)
  • default - Gray/secondary (default if not specified)

Next Steps

Modals

Open forms and dialogs from button clicks

Error Handling

Handle failures in action handlers