Tabs

A multi-variant tabs component for organizing content into switchable panels.

This is a standalone component that does not depend on the assistant-ui runtime. Use it anywhere in your application.

Manage your account settings and preferences.

Installation

npx shadcn@latest add https://r.assistant-ui.com/tabs.json

Usage

import {
  Tabs,
  TabsList,
  TabsTrigger,
  TabsContent,
} from "@/components/assistant-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 the variant prop on TabsList to change the visual style. Child components inherit the variant automatically.

Default
Line
Ghost
Pills
Outline
<TabsList variant="default" />  // Muted background with shadow (default)
<TabsList variant="line" />     // Underline indicator
<TabsList variant="ghost" />    // Transparent with hover states
<TabsList variant="pills" />    // Rounded pill buttons
<TabsList variant="outline" />  // Border with background on active

Sizes

Use the size prop on TabsList to change the tab height. Child components inherit the size automatically.

Small
Default
Large
<TabsList size="sm" />      // 32px height
<TabsList size="default" /> // 36px height
<TabsList size="lg" />      // 40px height

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

Use the asChild prop on TabsTrigger to render as a different element, like a navigation link.

Animated Indicator

All variants feature smooth animated indicators that slide between tabs:

VariantIndicator Style
defaultSliding background with shadow
lineSliding underline
ghostSliding background with hover effect
pillsSliding pill background
outlineSliding border
Default - Sliding background
Line - Sliding underline
Ghost - Sliding background with hover effect
Pills - Sliding pill background
Outline - Sliding border

API Reference

Composable API

ComponentDescription
TabsThe root component that manages tab state.
TabsListThe container for tab triggers. Set variant and size here.
TabsTriggerAn individual tab button. Inherits variant/size from TabsList.
TabsContentThe content panel for a tab.

Tabs

The root component that manages tab state.

TabsProps
defaultValue?: string

The default active tab value (uncontrolled).

value?: string

The controlled active tab value.

onValueChange?: (value: string) => void

Callback when the active tab changes.

className?: string

Additional CSS classes.

TabsList

The container for tab triggers. Set variant and size here to style all child components.

TabsListProps
variant: "default" | "line" | "ghost" | "pills" | "outline"= "default"

The visual style of the tabs. Child components inherit this automatically.

size: "sm" | "default" | "lg"= "default"

The size of the tabs. Child components inherit this automatically.

className?: string

Additional CSS classes.

TabsTrigger

An individual tab button.

TabsTriggerProps
valuerequired: string

The unique value for this tab.

asChild: boolean= false

Merge props with child element instead of rendering a button.

disabled?: boolean

Whether the tab is disabled.

className?: string

Additional CSS classes.

TabsContent

The content panel for a tab.

TabsContentProps
valuerequired: string

The value matching the corresponding TabsTrigger.

className?: string

Additional CSS classes.

Style Variants (CVA)

ExportDescription
tabsListVariantsStyles for the tabs list container.
tabsActiveIndicatorVariantsStyles for the animated active indicator.
import {
  tabsListVariants,
  tabsActiveIndicatorVariants,
} from "@/components/assistant-ui/tabs";

<div className={tabsListVariants({ variant: "ghost", size: "sm" })}>
  Custom Tabs Container
</div>