Command Palette

Search for a command to run...

Docs
Tabs

Tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Account settings

Installation

Run the following command:

Update your imports:
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"

Usage

import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
 
export default function Home() {
  return (
    <Tabs defaultValue="account" className="w-[400px]">
      <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>
  );
}

Props

Tabs

PropTypeDefaultDescription
variantdefault | underline | pill | rounded | folderdefaultStyle variant of the tabs

Radix UI Props

The Tabs components are built on Radix UI's Tabs primitive and support all their props:

Tabs Root Props

  • defaultValue: string - The value of the tab that should be active when initially rendered
  • value: string - The controlled value of the currently active tab
  • onValueChange: (value: string) => void - Event handler called when the value changes
  • orientation: 'horizontal' | 'vertical' - The orientation of the tabs
  • dir: 'ltr' | 'rtl' - The reading direction
  • activationMode: 'automatic' | 'manual' - Whether to auto-activate tabs on focus

TabsList Props

  • Standard Radix UI TabsList props

TabsTrigger Props

  • value: string (required) - A unique value for the tab
  • disabled: boolean - When true, prevents the user from interacting with the tab

TabsContent Props

  • value: string (required) - A unique value that associates the content with a trigger
  • forceMount: boolean - Force mounting when more control is needed
Additionally, all components support relevant HTML attributes and event handlers appropriate to their element type.