Tabs
An accessible tab set with arrow-key roving focus and tabpanels.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen to use
An accessible tab set with arrow-key roving focus and tabpanels.
Accessibility
Arrow keys move between items; the current item is marked aria-current. Tabs follow the WAI-ARIA tabs pattern (roving tabindex, Home/End).
Install and import
npx shadcn@latest add @prism/tabs
import { Tabs } from '@/components/prism/Tabs';
In a no-build prototype, read it from the bundle instead: const { Tabs } = window.PrismDesignSystem_39d121;
Props
| Prop | Type | Required | Description |
|---|---|---|---|
tabs | TabItem[] | Yes | |
selectedKey | string | null | — | Controlled selected tab id; null = nothing selected (the first enabled tab still takes keyboard focus). |
defaultKey | string | — | |
onSelectionChange | (id: string) => void | — | |
maxVisible | number | — | How many tabs to show in the row; the rest go in a "More" menu. The row never reorders: when the selected tab is a hidden one, the "More" button shows its name. Default: every tab, except on a phone-width screen with more than five, which collapses to four plus "More". Infinity never collapses (the row scrolls). |
moreLabel | string | — | Label of the overflow menu's button. Default "More". |
linkComponent | LinkComponent | — | Overrides LinkProvider's link component for href tabs. |
className | string | — |