Skip to main content
Tabs organize content into panels that users switch between by clicking triggers. Each Tab child defines a trigger label and the content shown when that tab is active.

Basic Usage

Tabs let you split related content across panels that share the same space, showing one at a time. Wrap a set of Tab blocks in a Tabs container; each Tab takes a visible title and a value that identifies it, and the Tabs value sets which panel opens first. Use tabs to keep a busy screen — like a settings page with separate account and password sections — organized without forcing the user to scroll past everything at once.

Variants

The variant prop controls the visual style of the tab triggers. The default uses a pill-style background, while "line" uses an underline indicator.

Orientation

Set orientation="vertical" to stack the tab triggers in a column alongside the content.

State Tracking

Give Tabs a name to sync the active tab with client state. Other components can then read or change which tab is active — useful for building wizard flows or linking navigation between different parts of the UI.
Tabs with State

Change Actions

Tabs writes the selected tab’s value to its named state before running on_change. Your actions can read that updated key or use $event, which contains the selected tab’s value. An explicit SetState in the handler can choose a different active tab. This example records the selected section after each change:

API Reference

Tabs Parameters

str
default:"default"
Visual style: "default" (pill background) or "line" (underline indicator).
str
default:"horizontal"
Layout direction: "horizontal" (triggers above content) or "vertical" (triggers beside content).
str | None
default:"None"
Value of the initially active tab. If omitted, the first tab is active.
str | None
default:"None"
State key for tracking the active tab. Enables reading/writing the active tab from other components.
Action | list[Action] | None
default:"None"
Action(s) triggered when the active tab changes.
str | None
default:"None"
Additional Tailwind CSS classes.

Tab Parameters

str
required
Tab trigger label. Can be passed as a positional argument.
str | None
default:"None"
Unique value identifying this tab. Defaults to the title.
bool
default:"False"
Whether this tab is disabled.

Protocol Reference

Tabs
Tab
For the complete protocol schema, see Tabs, Tab.