Skip to main content

Tabs

An accessible tab set with arrow-key roving focus and tabpanels.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When 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​

PropTypeRequiredDescription
tabsTabItem[]Yes
selectedKeystring | null—Controlled selected tab id; null = nothing selected (the first enabled tab still takes keyboard focus).
defaultKeystring—
onSelectionChange(id: string) => void—
maxVisiblenumber—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).
moreLabelstring—Label of the overflow menu's button. Default "More".
linkComponentLinkComponent—Overrides LinkProvider's link component for href tabs.
classNamestring—