Tabs
Switch between content panels with default and line style variants. Built on Radix UI.
Default
Pill-style tabs with a background indicator.
Line Variant
Underline-style tabs with a bottom border indicator.
Keyed Variant
A row of compact tabs that wraps onto as many lines as it needs. One highlight (a 1px key-colour edge over a 10% key fill) slides to the active tab in both directions, so it crosses a wrapped line too. It re-measures on resize, on font load and when tabs are added, removed or reordered; with prefers-reduced-motion it jumps. An icon placed before the label sits at 16px and takes the key colour when its tab is active. Extra children after the label (a small tag, say) render inside the trigger. size="compact" narrows the side padding from 12px to 10px. Theme it with --tabs-keyed-key, --tabs-keyed-fill, --tabs-keyed-ink and --tabs-keyed-radius.
Disabled Tab
Individual tabs can be disabled.
Installation
npx visor add tabsThis copies two files into your project:
components/ui/tabs/tabs.tsx— the componentcomponents/ui/tabs/tabs.module.css— the styles
Usage
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs/tabs';
<Tabs defaultValue="overview">
<TabsList variant="default">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
</TabsList>
<TabsContent value="overview">Overview content.</TabsContent>
<TabsContent value="settings">Settings content.</TabsContent>
</Tabs>API Reference
TabsProps
No props data available for “tabs”.
Sub-components
| Component | Element | Purpose |
|---|---|---|
Tabs | <div> (Radix Root) | Root container. Requires defaultValue or controlled value. |
TabsList | <div> | Horizontal container for tab triggers. Accepts variant (default, line, keyed) and, for keyed, size (default, compact). |
TabsTrigger | <button> | Clickable tab button tied to content via matching value prop. |
TabsContent | <div> | Content panel that displays when its matching trigger is active. |
Accessibility
- Built on
@radix-ui/react-tabswith full WAI-ARIA tab semantics. TabsListhasrole="tablist"; triggers haverole="tab"witharia-selected.- Content panels have
role="tabpanel"linked to their trigger viaaria-labelledby. ArrowLeft/ArrowRightnavigate between triggers;EnterorSpaceactivates.- Disabled triggers receive
aria-disabled="true"and are skipped in keyboard navigation.
Label Centering
The label is optically centred in any font: its line box is trimmed to the capital-height band, so capitals (not the font's ascent and descent) sit on the box centre, with the box size unchanged. Firefox keeps the previous rendering. Shared spec: docs/label-centering.md.
Stepper
A multi-step progress indicator with horizontal and vertical orientations. Auto-derives step status from activeStep with accessible ARIA roles — copy it into your project and own it completely.
Context Menu
A menu that appears on right-click or long-press. Built on Radix UI with support for nested submenus, checkboxes, radio items, shortcuts, and disabled states.