A set of layered sections of content — known as tab panels — that are displayed one at a time. Demonstrated in all state modes plus patch mode.

Client-only Tabs

No server events. Tab switching happens purely via JavaScript — zero latency.

Line Variant

The line variant uses an underline indicator instead of a background pill. The ::after pseudo-element provides the active underline.

Vertical Orientation

Set orientation="vertical" for side-by-side layout. Arrow keys switch from horizontal (Left/Right) to vertical (Up/Down).

Hybrid

JS switches tabs 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 active tab externally. Content panels use :if — only the active panel is in the DOM.

Server tab: "account"

Push Event (Server → Client)

The server pushes commands to a client-mode tabs via push_event/3. The tabs have no value or on_value_change — they're client-only, but the server can still command them.

Patch Mode — Path Params

Triggers render as link patches instead of buttons. The URL updates to /showcase/tabs/:tab and handle_params/3 reads the active tab from the path. Supports browser back/forward navigation.

Path param tab: "settings"

Patch Mode — Query Params

Same pattern but with query parameters: /showcase/tabs?tab=.... Useful when you want tabs on a page without changing the route path.

Query param tab: "overview"