Manage your account settings and preferences.
Installation
npx shadcn@latest add @assistant-ui/tabsThe @assistant-ui namespace resolves the Radix or Base UI flavor from your project's style through the style-aware registry entry in components.json. Without that entry, add by direct URL instead:
npx shadcn@latest add https://r.assistant-ui.com/base/tabs.jsonMain Component
npm install @base-ui/react class-variance-authorityUsage
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from "@/components/ui/tabs";
export function Example() {
return (
<Tabs defaultValue="account">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">Account settings here.</TabsContent>
<TabsContent value="password">Password settings here.</TabsContent>
</Tabs>
);
}Examples
Variants
Use default for a contained control or line for navigation-style tabs.
<TabsList variant="default" />
<TabsList variant="line" />With icons
Tabs automatically style SVG icons placed inside triggers.
Edit your profile information.
Controlled
Use value and onValueChange for controlled tab state.
Overview content
Current tab: overview
As link
Compose with render in Base UI or asChild in Radix to render a trigger as a link.
API Reference
Composable API
| Component | Description |
|---|---|
Tabs | The root component that manages tab state and orientation. |
TabsList | The container for tab triggers. |
TabsTrigger | An individual tab control. |
TabsContent | The content panel for a tab. |
Tabs
TabsPropsdefaultValue?: stringThe initial active tab for uncontrolled state.
value?: stringThe controlled active tab.
onValueChange?: (value: string) => voidCalled when the active tab changes.
orientation: "horizontal" | "vertical"= "horizontal"The direction of the tab list and keyboard navigation.
TabsList
TabsListPropsvariant: "default" | "line"= "default"The visual style of the tab list.
className?: stringAdditional CSS classes.
TabsTrigger
TabsTriggerPropsvalue: stringThe unique value for the tab.
disabled?: booleanWhether the tab is disabled.
render?: ReactElement | functionBase UI: compose as a different element.
asChild: boolean= falseRadix: merge props with a child element.
TabsContent
TabsContentPropsvalue: stringThe value matching the corresponding trigger.
className?: stringAdditional CSS classes.
Style variants
| Export | Description |
|---|---|
tabsListVariants | Styles for the tab list container. |
import { tabsListVariants } from "@/components/ui/tabs";
<div className={tabsListVariants({ variant: "line" })}>
Custom tab list
</div>