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 tabs --base radix

Usage

Import
import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@/components/cubix/tabs"
Example
<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

PropTypeDefaultDescription
valuestring-Controlled active tab value. Use with `onValueChange`.
defaultValuestring-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.
classNamestring-Additional Tailwind classes merged with the root styles.

TabsList

PropTypeDefaultDescription
variant"default" | "line""default"The visual style of the tabs list.
classNamestring-Additional Tailwind classes merged with the list styles.

TabsTrigger

PropTypeDefaultDescription
valuestring-The tab value selected by this trigger.
disabledbooleanfalseDisables the trigger and prevents interaction.
classNamestring-Additional Tailwind classes merged with the trigger styles.

TabsContent

PropTypeDefaultDescription
valuestring-The tab value that controls when this panel is shown.
classNamestring-Additional Tailwind classes merged with the content styles.