ComponentsNavigation
Tabs
Switch between related views. Line and segmented styles.
Switch between related views. Line and segmented styles.
<Tabs defaultValue="overview">
<TabsList aria-label="Project">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
</TabsList>
<TabsContent value="overview">...</TabsContent>
<TabsContent value="activity">...</TabsContent>
<TabsContent value="settings">...</TabsContent>
</Tabs>The same component at all four levels. Pick the one that fits your project; they share tokens, so they mix.
npm i junco @junco/tailwindimport { Tabs, TabsList, TabsTrigger, TabsContent } from "junco";
<Tabs defaultValue="overview">
<TabsList aria-label="Project">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
</TabsList>
<TabsContent value="overview">...</TabsContent>
<TabsContent value="activity">...</TabsContent>
</Tabs>Badges sit inside triggers. Disabled tabs are skipped by the arrow keys.
Tabs#value / defaultValueonValueChangevariantorientationactivationMode| Prop | Type | Default |
|---|---|---|
value / defaultValueControlled or initial tab. | string | – |
onValueChangeCalled when the tab changes. | (value: string) => void | – |
variantUnderline for page sections, segmented for compact view switches. | "line" | "segmented" | "line" |
orientationWhich arrow keys move between tabs. | "horizontal" | "vertical" | "horizontal" |
activationModeManual means arrows move focus and Enter/Space activates. | "automatic" | "manual" | "automatic" |
TabsTrigger#valuedisabled| Prop | Type | Default |
|---|---|---|
valueRequired. Matches a TabsContent. | string | – |
disabledSkipped by the keyboard. | boolean | false |
TabsContent#value| Prop | Type | Default |
|---|---|---|
valueRequired. Shown when its trigger is active. | string | – |
| Key | Action |
|---|---|
| Tab | Moves focus to the active tab, then into the panel. |
| ←→ | Moves to the previous or next tab. |
| HomeEnd | Moves to the first or last tab. |