Design · Components · Navigation

Tabs

A tabs component for organizing content into switchable panels.

Manage your account settings and preferences.

Installation

npx shadcn@latest add @assistant-ui/tabs

The @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.json

Usage

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.

Default
Line
Ghost
Pills
Outline
<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

Compose with render in Base UI or asChild in Radix to render a trigger as a link.

API Reference

Composable API

ComponentDescription
TabsThe root component that manages tab state and orientation.
TabsListThe container for tab triggers.
TabsTriggerAn individual tab control.
TabsContentThe content panel for a tab.

Tabs

TabsProps
defaultValue ?: string

The initial active tab for uncontrolled state.

value ?: string

The controlled active tab.

onValueChange ?: (value: string) => void

Called when the active tab changes.

orientation : "horizontal" | "vertical" = "horizontal"

The direction of the tab list and keyboard navigation.

TabsList

TabsListProps
variant : "default" | "line" = "default"

The visual style of the tab list.

className ?: string

Additional CSS classes.

TabsTrigger

TabsTriggerProps
value : string

The unique value for the tab.

disabled ?: boolean

Whether the tab is disabled.

render ?: ReactElement | function

Base UI: compose as a different element.

asChild : boolean = false

Radix: merge props with a child element.

TabsContent

TabsContentProps
value : string

The value matching the corresponding trigger.

className ?: string

Additional CSS classes.

Style variants

ExportDescription
tabsListVariantsStyles for the tab list container.
import { tabsListVariants } from "@/components/ui/tabs";

<div className={tabsListVariants({ variant: "line" })}>
  Custom tab list
</div>