Skip to content

Tabs

Switch between related views in the same context. Keep tab labels short and panels self-contained.

Examples

Sections

Summary of activity and recent updates.

Overview

Tabs pair a list of tabs with matching panels. Place TabsIndicator inside the list for the animated underline under the active tab. Built on Base UI for keyboard and focus behavior.

tsx

import {
  Tabs,
  TabsList,
  TabsTab,
  TabsIndicator,
  TabsPanel,
} from "@standard-ui/react"

<Tabs defaultValue="overview">
  <TabsList>
    <TabsTab value="overview">Overview</TabsTab>
    <TabsTab value="projects">Projects</TabsTab>
    <TabsTab value="account">Account</TabsTab>
    <TabsIndicator />
  </TabsList>
  <TabsPanel value="overview"></TabsPanel>
</Tabs>

Usage

Values

Each tab and panel share a value. Set defaultValue (or controlled value) on the root to the first tab you want active.

tsx

<Tabs defaultValue="overview">
  <TabsList>
    <TabsTab value="overview">Overview</TabsTab>
    <TabsTab value="projects">Projects</TabsTab>
  </TabsList>
  <TabsPanel value="overview"></TabsPanel>
  <TabsPanel value="projects"></TabsPanel>
</Tabs>

Indicator

Render TabsIndicator as a sibling of the tabs inside TabsList. It tracks the active tab width and offset.

tsx

<TabsList>
  <TabsTab value="overview">Overview</TabsTab>
  <TabsTab value="projects">Projects</TabsTab>
  <TabsIndicator />
</TabsList>

API

Root accepts Base UI Tabs props. Parts:

Prop / partTypeDefaultDescription
defaultValuestring | number | nullUncontrolled initially active tab.
valuestring | number | nullControlled active tab.
onValueChange(value, event) => voidCalled when the active tab changes.
TabsListContainer for tabs and the indicator.
TabsTabTab control. Requires a value.
TabsIndicatorAnimated underline under the active tab.
TabsPanelPanel content for a matching value.

Guidelines

Do

  • Use sentence-case labels — Overview, not OVERVIEW
  • Keep panels related — same object, different facets
  • Include TabsIndicator for clear selection affordance

Don't

  • Don't use tabs for primary app navigation across routes
  • Don't put more than five or six tabs in one list
  • Don't mismatch tab and panel values