A control that allows the user to toggle between checked and unchecked. Demonstrated in all 3 state modes.

Client-only Switch

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

Sizes

Two sizes: default and sm.

Hybrid

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

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 switch externally.

Server checked: false

Push Event (Server → Client)

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