Tabs
Use Tabs to switch between related views within the same page and context.
Preview
Portfolio views
Switch between overview, activity, and settings; the overview begins with an illustrative portfolio value and monthly change.
Installation
New to this Registry? Complete the base setup before continuing.
npx shadcn@latest add @neumorphism-ui/tabsInstall the shared base once, then add components and their dependencies with the CLI.
Usage
Give TabsList a name and match each TabsTrigger value to its TabsContent. Choose a default value and use controlled state when other controls must follow the active view.
"use client";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
export default function Example() {
return (
<Tabs defaultValue="profile">
<TabsList aria-label="Account settings">
<TabsTrigger value="profile">Profile</TabsTrigger>
<TabsTrigger value="security">Security</TabsTrigger>
</TabsList>
<TabsContent value="profile">Edit your profile.</TabsContent>
<TabsContent value="security">Manage your security settings.</TabsContent>
</Tabs>
);
}API Reference
Built on Base UI Tabs with the active trigger rendered as a raised surface and the list as an inset track. Supports controlled and uncontrolled values, automatic or manual activation, and horizontal or vertical orientation.
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Tabs | value / defaultValue | string | — | The controlled active tab value or initial uncontrolled value. |
Tabs | onValueChange | (value: string) => void | — | Called when the active tab changes. |
Tabs | orientation | "horizontal" | "vertical" | "horizontal" | Sets the list orientation and Arrow key navigation axis. |
TabsList | activateOnFocus | boolean | false | Determines whether moving focus with Arrow keys also activates the panel. |
TabsTrigger | valuerequired | string | — | A unique value shared with the associated TabsContent. |
TabsContent | valuerequired | string | — | The trigger value that opens the panel. |
Accessibility
- 01
Name the tab group on TabsList with aria-label or aria-labelledby.
- 02
Base UI manages tab, tablist, and tabpanel roles and the aria-controls and aria-selected relationships.
- 03
Use activateOnFocus on TabsList only when panel switching is immediate.