Tabs
Switches between views of one thing, in place. The panel lives in the same document as the tab, which is what the tab role promises a screen reader.
Reach for it
Panels of one thing, in the same document.
Not for
Anything that changes the URL. That is Tab nav.
Panels of one record
Arrow keys move between tabs, Home and End jump to the ends, and the panel is reachable only after the tab list. A panel is mounted when its tab becomes active, so a heavy view costs nothing until someone opens it.
Arrow keys move between tabs, Home and End jump to the ends, and the panel is only reachable after the tab list. Base UI owns all of that.
API reference
Tabs
Also takes the props of Base UI Tabs Root.
TabsList
| Prop | Type | Default | Description |
|---|---|---|---|
| label* | string | - | |
| children* | ReactNode | - |
TabsTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| value* | string | - | |
| children* | ReactNode | - | |
| render | TabsPrimitive.Tab.Props['render'] | - | The element the tab renders as, instead of a button. A tab strip that changes the route should render each tab as the host app's link element. The router then prefetches the destination, the tab carries a real href, and the middle click and "open in new tab" the user expects from navigation keep working. The strip keeps its own styling and the primitive keeps the ARIA wiring either way. Pass the link element and let the tab own the rest: `render={<Link href={href} />}`. Leave `onValueChange` off the root when you use this, or the click navigates twice. |
TabsContent
| Prop | Type | Default | Description |
|---|---|---|---|
| value* | string | - | |
| children* | ReactNode | - |