A two-state button that can be toggled on or off, plus ToggleGroup for managing single/multiple selection across a set of toggles. Demonstrated in all 3 state modes.

Client-only Toggle

No server events. The toggle flips purely via JavaScript — zero latency.

Client-only ToggleGroup

Single and multiple selection modes. No server involvement.

Single (alignment)

Multiple (text formatting)

Outline variant (spacing=0)

Hybrid

JS toggles instantly for responsiveness, then pushes the event to the server. The event log below updates via LiveView.

Toggle

ToggleGroup

Event Log
Toggle an item above to see events appear here.

Server-controlled

The server owns the state. Use the buttons below to control the toggle and group externally.

Toggle

ToggleGroup

Server pressed: false
Server group value: ""

Push Event (Server → Client)

The server pushes commands to a client-mode toggle via push_event/3. The toggle has no pressed or on_pressed_change — it's client-only, but the server can still command it.