Tabs
Panel switching with roving arrow-key focus, taken from @zag-js/tabs.
Interactive Preview
Section titled “Interactive Preview”Manage workspace settings.
Review member activity.
Recent change history.
Manage workspace settings.
Review member activity.
Recent change history.
import { Tabs } from "@/components/ui/tabs";
const panels = [ { label: "Settings", value: "schedule", content: "Manage workspace settings." }, { label: "Activity", value: "hadir", content: "Review member activity." },];
<Tabs items={panels} defaultValue="schedule" /><script lang="ts"> import Tabs from "@/components/ui/tabs.svelte";</script>
<script lang="ts"> const panels = [ { label: "Settings", value: "schedule", content: "Manage workspace settings." }, { label: "Activity", value: "hadir", content: "Review member activity." }, ];</script>
<Tabs items={panels} defaultValue="schedule" />import { Tabs } from "@/components/ui/tabs";
const panels = [ { label: "Settings", value: "schedule", content: "Manage workspace settings." }, { label: "Activity", value: "hadir", content: "Review member activity." },];
<Tabs items={panels} defaultValue="schedule" />Installation
Section titled “Installation”npx @glaceon/cli add tabs --framework react # or svelte, solidbun add @zag-js/react @zag-js/tabsCopy your framework’s implementation into your project. (Note: Code blocks omitted for brevity in preview, please refer to the source repository for full component code).
Data Attributes
Section titled “Data Attributes”| Element | Data Attribute | Value | Description |
|---|---|---|---|
trigger |
data-selected |
"" |
The active tab. This machine emits data-selected, not data-state="active". |
trigger |
data-disabled |
"" |
Present when the tab cannot be chosen. |
trigger |
data-focus |
"" |
The tab holds focus. |
trigger |
data-orientation |
"horizontal" | "vertical" |
Layout axis. |
trigger |
data-value |
string | The tab’s value. |
content |
data-selected |
"" |
The visible panel. |
API Reference (Props)
Section titled “API Reference (Props)”| Prop | Type | Default | Description |
|---|---|---|---|
items |
{ label: string, value: string, content: string }[] |
required | Tabs and their panels. |
defaultValue |
string |
first item | The tab selected on first render. |
class / className |
string |
undefined |
Extra classes for the root, appended last. |
contentClass |
string |
undefined |
Extra classes for each panel. |
Keyboard Interactions
Section titled “Keyboard Interactions”| Key | Description |
|---|---|
Tab |
Moves focus into the tab list, landing on the selected tab. |
ArrowLeft / ArrowRight |
Moves between tabs, following focus. |
Home / End |
Jumps to the first or last tab. |