# Button action

> Start a flow when someone presses a button, or picks from a menu, that names the action.

Source: https://docs.buildcord.dev/nodes/triggers/button-action/

`trigger.action` runs when someone presses a button, or makes a choice in a select menu, that names this action. It works for as long as the message exists, however old it is.

## Settings

| Setting | What it does |
| --- | --- |
| Action | A short name. Buttons and menus point at it from their settings in Components. Only one flow can use each action name. |

## Ways out

`out`.

## Produces

| Token | Value |
| --- | --- |
| `{component.data}` | What the button or menu was sent with, such as a row's number |
| `{component.message}` | The ID of the message it's on |
| `{component.choiceLabel}` | From a menu: the choice made |
| `{component.choice}` | From a menu: the choice's ID |

## Notes

- Answer the press with [Update the button's message](https://docs.buildcord.dev/nodes/messages/update-button-message) or [Reply](https://docs.buildcord.dev/nodes/messages/reply).
- A button or menu without an action only continues the run that sent it, and only for a day. Use an action for anything lasting, such as a poll, a role menu or a ticket panel.
- If a button or menu names an action that no flow runs, the checker reports an error.

## Example

A role menu whose choices are colours, pointed at an action whose flow is a [Switch](https://docs.buildcord.dev/nodes/conditions/switch) on `{component.choiceLabel}` with an [Add role](https://docs.buildcord.dev/nodes/members/add-role) for each.

## Related

- [Designs](https://docs.buildcord.dev/concepts/designs)
- [Message with buttons or a menu](https://docs.buildcord.dev/nodes/messages/message-with-buttons)
