Skip to content
Drivn logoDrivn

Tabs

Composable tab navigation with dot notation and panel content.

Preview

Manage your account settings and preferences.

Installation

npx drivn add tabs

Usage

1import { Tabs } from "@/components/ui/tabs"
2
3export default function Page() {
4 return (
5 <Tabs defaultValue="overview">
6 <Tabs.List>
7 <Tabs.Tab value="overview">Overview</Tabs.Tab>
8 <Tabs.Tab value="usage">Usage</Tabs.Tab>
9 <Tabs.Tab value="api">API</Tabs.Tab>
10 </Tabs.List>
11 <Tabs.Panel value="overview">
12 Overview content here.
13 </Tabs.Panel>
14 <Tabs.Panel value="usage">
15 Usage content here.
16 </Tabs.Panel>
17 <Tabs.Panel value="api">
18 API content here.
19 </Tabs.Panel>
20 </Tabs>
21 )
22}

API Reference

Tabs

PropTypeDefaultDescription
defaultValuestringInitial active tab value for uncontrolled mode
valuestringControlled active tab value
onChange(value: string) => voidCallback fired when the active tab changes
classNamestringAdditional CSS classes to apply
childrenReactNodeTabs sub-components (List, Tab, Panel)

Tabs.Tab

PropTypeDefaultDescription
valuestringUnique value identifying this tab
childrenReactNodeTab label content

Tabs.Panel

PropTypeDefaultDescription
valuestringValue matching the corresponding Tab
childrenReactNodePanel content displayed when tab is active