Tabs

A set of layered sections of content that are displayed one at a time.

Installation

bash
npx shadcn@latest add tabs

Import

import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"

Default

Manage your account settings.

Disabled tab

Account content.

Props

Tabs

PROPTYPEDEFAULTDESCRIPTION
defaultValuestringDefault active tab value (uncontrolled)
valuestringControlled active tab value
onValueChange(value: string) => voidCalled when active tab changes
orientation"horizontal" | "vertical""horizontal"Orientation of the tab list

TabsTrigger

PROPTYPEDEFAULTDESCRIPTION
valuestringUnique value identifying this tab (required)
disabledbooleanfalseDisables the tab trigger

TabsContent

PROPTYPEDEFAULTDESCRIPTION
valuestringValue matching the corresponding TabsTrigger (required)
forceMountbooleanfalseForce mount the content even when not active

Accessibility

  • Arrow Left/Right navigates between tabs
  • Space/Enter activates the focused tab
  • Each panel is linked to its trigger via aria-controls