Skip to content

Tabs

Shows one panel of related content at a time.

Studio North is due October 18.
tabs-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • Tabs

    Owns the selected panel.

    • TabsList

      Scrolls when the tabs do not fit.

      • TabsTriggerRepeats
    • TabsContentRepeats

With icons

Three of five tasks are complete.
tabs-demo.tsx

Disabled tab

The arrow keys skip a disabled tab.

You are on the Team plan.
tabs-disabled-demo.tsx

Vertical

In a narrow space, the panel moves below the tabs.

Your name and photo appear on shared projects.
tabs-vertical-demo.tsx

Many tabs

The list scrolls and keeps the focused tab in view.

Studio North has 12 open tasks.
tabs-overflow-demo.tsx

Sizes

tabs-sizes-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria Tabs (opens in a new tab).

TabsList

size: "xs" | "sm" | "md" | "lg" | "xl"
Uses the Button heights for each tab. Without a size, tabs are 44 pixels high on small screens and 36 pixels from 640 pixels.

Tabs

value: string
The value of the selected tab, controlled. Same as selectedKey.
defaultValue: string
The value of the tab that is selected at first, uncontrolled. Same as defaultSelectedKey.
onValueChange: (value: string) => void
Gets the value of the selected tab as a string. onSelectionChange also works.

TabsTrigger

value: string
Connects the tab to the TabsContent with the same value.
size: "xs" | "sm" | "md" | "lg" | "xl"
Sets the size of this tab. It overrides the size of the TabsList.

TabsContent

value: string
Connects the panel to the TabsTrigger with the same value.