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

# Actions & Events

> Reacting to clicks and value changes — publishing commands and navigating between panels.

![An operator control panel with Start and Stop Conveyor buttons and a speed setpoint field, each wired to an event handler that publishes commands](https://mintcdn.com/coreflux/ry-30sFxFVWzN72U/images/dashboard/patterns/control-panel.png?fit=max\&auto=format\&n=ry-30sFxFVWzN72U\&q=85\&s=7bf104e56761bbaae30067a2eab551dc)

Events make a panel interactive: a click publishes a command, a field change writes a setpoint. The pattern is always `ON <EVENT> DO <ACTION>`.

> [!TIP]
>
> **Like a light switch wired to more than a light.** Flipping it (the event) can turn on the lamp, ring a bell, and log the time (the actions) — the switch doesn't care what's wired to it.

***

First the event triggers, then each action you can wire to them. The broker parses this grammar; which triggers the HUB actually dispatches, and any write-back caveats, are documented with the [input components](/hub/dashboards/components/inputs) — that catalog ships with the HUB, not the broker.

## Event triggers

| Event | Fires when |
| - | - |
| `ON CLICK DO` | Mouse click / tap |
| `ON CHANGE DO` | Value changed (`text-field`, `number-field`) |
| `ON TOGGLE DO` | Toggle state changed — see [input components](/hub/dashboards/components/inputs) for HUB write-back support |

## Actions

### Publish to a topic

The workhorse: send a command or value to any MQTT topic.

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ON CLICK DO
    PUBLISH TOPIC "factory/commands/start" WITH 1
```

Literal payloads on buttons work out of the box. On `text-field` and `number-field`, use `WITH VALUE` to publish what the operator typed — see the [Input components](/hub/dashboards/components/inputs) page for full write-back examples.

### Navigate between panels

Jump to another panel by name:

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ON CLICK DO
    NAVIGATE TO PANEL "Zone1Details"
```

Or return to the previous panel:

```lot wrap theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
ON CLICK DO
    NAVIGATE BACK
```

See the [Navigation section in Defining a Panel](/v2.14/lot-language/panels/defining-panels#navigation) for a complete overview-and-detail example with screenshots.

## Common mistakes

> **The control shows data but does nothing when used**
>
> Input components don't publish by themselves — the `ON <EVENT> DO` handler does. A button without `ON CLICK DO PUBLISH ...` is a label in practice.

> **The handler runs but nothing changes on the panel**
>
> `PUBLISH` writes to the broker; the panel only reflects it if some component **binds** to that topic. Check the bound topic and the published topic match (command vs. feedback topics are often intentionally different).

## Next Steps

> **[Input & control components](/hub/dashboards/components/inputs)**
>
> The controls that fire these events, with full write-back examples.

> **[Common patterns](/hub/dashboards/patterns)**
>
> Complete panels that put events and actions to work.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.