> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainlit.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Action

Actions are a way to send clickable buttons to the user interface. Each action is attached to a [Message](/api-reference/message) and can be used to trigger a python function when the user clicks on it.

## Create an action

Actions are sent to the UI through messages:

```python theme={null}
import chainlit as cl

@cl.on_chat_start
async def start():
    # Sending an action button within a chatbot message
    actions = [
        cl.Action(
            name="action_button",
            icon="mouse-pointer-click",
            payload={"value": "example_value"},
            label="Click me!"
        )
    ]

    await cl.Message(content="Interact with this action button:", actions=actions).send()
```

## Define a Python Callback

To handle the user's click on the action button, you need to define a callback function with the `@cl.action_callback` decorator:

```python theme={null}
@cl.action_callback("action_button")
async def on_action(action: cl.Action):
    print(action.payload)
```

<Card title="Action API" color="#FFCF30" icon="bolt" href="/api-reference/action">
  Learn how more about Actions.
</Card>
