Skip to content
Browse docs and components

Tabs

tabs

Tabs built on the Base UI primitive, so arrow keys, Home and End and the roving tab order come for free. The primitive measures the selected tab and publishes it as a CSS variable, so the underline glides without this component holding a single ref.

Responsive

Install

$npxshadcnadd@forme/tabs

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger } from "@/components/forme/tabs/tabs";

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

When to use

Reach for it

  • Sibling panels of the same object — Overview, Activity, Settings — where only one is needed at a time.

Use something else

  • Switching how the same content is shown (List, Board): that is a SegmentedControl.
  • Steps that must happen in order; use Steps.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

Parts

  • TabsTakes Base UI Tabs.Root
  • TabsListTakes Base UI Tabs.List
  • TabsIndicatorTakes Base UI Tabs.Indicator
  • TabsTriggerTakes Base UI Tabs.Tab
  • TabsContentTakes Base UI Tabs.Panel

Accessibility

  • The WAI-ARIA tabs pattern from Base UI: one tab stop for the list, arrow keys between tabs, and each panel labelled by its tab.

Motion

  • The underline glides to the selected tab using measurements Base UI writes as custom properties.
  • It renders before hydration, so a server-rendered page shows it on the first frame.