Tabs
A set of layered sections of content, known as tab panels, displayed one at a time.
Make changes to your account here.
Installation
pnpm dlx cubix@latest add tabsUsage
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@/components/cubix/tabs"<Tabs defaultValue="account" className="w-full max-w-md">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">Make changes to your account here.</TabsContent>
<TabsContent value="password">Change your password here.</TabsContent>
</Tabs>Examples
Line variant
Overview content.
With icons
Profile preferences.
Vertical
General settings.
Disabled tab
The active tab panel.
API Reference
Note: Tabs follows the Tabs uses composable primitive names and renders slots for targeting: tabs, tabs-list, tabs-trigger, and tabs-content.
Tabs
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled active tab value. Use with `onValueChange`. |
| defaultValue | string | - | Default active tab value for uncontrolled usage. |
| onValueChange | (value: string) => void | - | Called when a tab trigger selects a new value. |
| orientation | "horizontal" | "vertical" | "horizontal" | The orientation of the tabs list and triggers. |
| className | string | - | Additional Tailwind classes merged with the root styles. |
TabsList
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "line" | "default" | The visual style of the tabs list. |
| className | string | - | Additional Tailwind classes merged with the list styles. |
TabsTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | The tab value selected by this trigger. |
| disabled | boolean | false | Disables the trigger and prevents interaction. |
| className | string | - | Additional Tailwind classes merged with the trigger styles. |
TabsContent
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | The tab value that controls when this panel is shown. |
| className | string | - | Additional Tailwind classes merged with the content styles. |