Tabs

A set of related panels where one section of content is visible at a time.

Installation

pnpm add @notion-kit/ui

Anatomy

<Tabs defaultValue="overview">
  <TabsList>
    <TabsTrigger value="overview">Overview</TabsTrigger>
    <TabsTrigger value="activity">Activity</TabsTrigger>
  </TabsList>
  <TabsContent value="overview">Overview content</TabsContent>
  <TabsContent value="activity">Activity content</TabsContent>
</Tabs>

Examples


Controlled

Use value and onValueChange when the selected tab is owned by parent state.

API Reference

Tabs

The root component that manages the selected tab. It accepts Base UI Tabs root props and the controlled value props below.

PropTypeDefaultDescription
defaultValueTabValueFirst tabThe uncontrolled initial tab value.
valueTabValue-The controlled selected tab value.
onValueChange(value: TabValue) => void-Handler called when a tab is selected.
orientation"horizontal" | "vertical""horizontal"The tab navigation orientation.

TabsList

The container for tab triggers.

PropTypeDefaultDescription
activateOnFocusbooleanfalseWhether arrow-key focus also activates the tab.
loopFocusbooleantrueWhether keyboard focus loops through the list.

TabsTrigger

A selectable tab. Its value must match a TabsContent value.

PropTypeDefaultDescription
valueTabValue-The value selected by the trigger.
disabledboolean-Whether this trigger is disabled.

TabsContent

The panel associated with a tab trigger.

PropTypeDefaultDescription
valueTabValue-The trigger value that shows this panel.
keepMountedbooleanfalseWhether the panel remains mounted when hidden.