Tabs
A navigation control on Ark UI's Tabs machine — a row (or column) of triggers over a hairline baseline, each revealing its own content panel, with an underline or an enclosed box that slides to the active trigger.
Tabs is a navigation control: a row (or column) of triggers over a hairline baseline that spans the whole strip, each trigger revealing its own content panel. An indicator slides to the active trigger: an underline by default, or an enclosed box attached to the panel. Tabs is navigation, not a form control, so it has no Field integration.
Looking for a segmented pill tray? That's SegmentGroup: a single-choice value with the filled / light / outline / subtle / default variants. Tabs dropped that look in favor of these two classic treatments.
import { Tabs } from '@42-central/ui-react/tabs';
<Tabs
defaultValue="overview"
data={[
{ value: 'overview', label: 'Overview', content: <Overview /> },
{ value: 'activity', label: 'Activity', content: <Activity /> },
]}
/>Playground
Component
Dir
Presets
Props
Code
<Component orientation="horizontal" size="md" />Items
data is a flat array of { value, label, content, disabled?, color? } — each tab needs its own content, so (unlike SegmentGroup) there's no bare-string shorthand.
<Tabs
defaultValue="overview"
data={[
{ value: 'overview', label: 'Overview', content: <Overview /> },
{ value: 'activity', label: 'Activity', content: <Activity /> },
{ value: 'settings', label: 'Settings', content: <Settings />, disabled: true },
]}
/>Each item also accepts an optional testId, defaulting to `tab-${value}` — the matching
content panel gets `${testId}-panel`. See the Testing guide. The compound
Tabs.Trigger / Tabs.Content / Tabs.List / Tabs.Root / Tabs.Indicator parts each take
their own testId prop directly, for the same reason.
Variants
Two treatments. underline (the default) draws a 2px bar on the baseline under the active tab. enclosed turns the active tab into a hairline box open at the bottom, so it reads as attached to its panel.
Code
<Tabs defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs variant="enclosed" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />On any surface
Neither variant paints a background. The enclosed box draws the baseline itself, running out from its two bottom corners to the ends of the list, so the line is open under the active tab without covering anything: the strip reads the same on a Card or a tinted panel as on the page.
Code
<div className="flex w-full flex-col gap-4">
<Card><Tabs variant="enclosed" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} /></Card>
<Card variant="light" color="green"><Tabs variant="enclosed" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} /></Card>
</div>Sizes
Five sizes — xs through xl — matching the rest of the family. Sizing lives on the triggers; the gap between them scales alongside.
Code
<Tabs size="xs" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }]} />
<Tabs size="sm" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }]} />
<Tabs size="md" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }]} />
<Tabs size="lg" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }]} />
<Tabs size="xl" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }]} />Colors
Without a color, the strip is neutral: the resting labels are the secondary text color, and the bar and the active label the primary one. With a color, the active label takes the palette's text color and the underline bar its solid color; the resting labels stay neutral. color is scoped to the tab strip: it does not tint whatever your panels render, so a Button inside a panel keeps its own palette.
Code
<Tabs color="neutral" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs color="brand" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs color="green" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs color="orange" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs color="red" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />Per-tab color
Give an item its own color (or Tabs.Trigger a color prop) to tint that tab alone. Its selected label takes the palette, and the indicator switches palette with the selection, cross-fading as it slides. A tab's color beats the color prop; a tab without one falls back to it, or stays neutral.
Code
<Tabs defaultValue="validated" data={[{ value: 'all', label: 'All', content: '12 projects' }, { value: 'validated', label: 'Validated', content: '7 validated', color: 'green' }, { value: 'waiting', label: 'Waiting', content: '3 waiting', color: 'orange' }, { value: 'failed', label: 'Failed', content: '2 failed', color: 'red' }]} />
<Tabs variant="enclosed" defaultValue="validated" data={[{ value: 'all', label: 'All', content: '12 projects' }, { value: 'validated', label: 'Validated', content: '7 validated', color: 'green' }, { value: 'waiting', label: 'Waiting', content: '3 waiting', color: 'orange' }, { value: 'failed', label: 'Failed', content: '2 failed', color: 'red' }]} />Full width
Set grow to give every tab an even share of the strip, like a tab bar. On the compound API it lives on Tabs.List. The indicator follows the active tab as the strip resizes.
Code
<Tabs grow defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />
<Tabs grow variant="enclosed" defaultValue="a" data={[{ value: 'a', label: 'Overview', content: 'A' }, { value: 'b', label: 'Activity', content: 'B' }, { value: 'c', label: 'Settings', content: 'C' }]} />Orientation
Set orientation="vertical" to stack the triggers in a column, with the panels beside it instead of below. The baseline moves to the list's inline-end edge (the left edge in a right-to-left locale), between the triggers and the panels, and the underline and the enclosed box follow it.
Disabled tab
A single tab can be disabled via { value, label, content, disabled: true }. It's skipped by keyboard navigation and can't be clicked.
Compound API
Drop to the composable parts for anything the flat data array can't express — custom trigger content, interleaved non-tab elements, or driving the value from your own state. variant, size, color and grow all live on Tabs.List and apply to the baseline, every trigger, and the indicator. color is a data-color attribute on the list specifically — putting it on Tabs.Root would also cover every Tabs.Content, leaking the palette into your panel content.
'use client';
import { Tabs } from '@42-central/ui-react/tabs';
<Tabs.Root defaultValue="overview">
<Tabs.List variant="enclosed" color="brand">
<Tabs.Indicator />
<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
<Tabs.Trigger value="activity">Activity</Tabs.Trigger>
</Tabs.List>
<Tabs.Content value="overview"><Overview /></Tabs.Content>
<Tabs.Content value="activity"><Activity /></Tabs.Content>
</Tabs.Root>Controlled
Drive the value from state. onChange hands you the selected value directly (the data-driven form); the compound Tabs.Root takes Ark's own value / onValueChange.
'use client';
import { useState } from 'react';
import { Tabs } from '@42-central/ui-react/tabs';
export function ProjectTabs() {
const [tab, setTab] = useState('overview');
return (
<Tabs
value={tab}
onChange={setTab}
data={[
{ value: 'overview', label: 'Overview', content: <Overview /> },
{ value: 'activity', label: 'Activity', content: <Activity /> },
]}
/>
);
}API
Prop
Type
Accessibility
- Built on Ark UI's Tabs machine:
role="tablist"/"tab"/"tabpanel", witharia-selectedand rovingtabIndexon the triggers andaria-controls/aria-labelledbylinking each trigger to its panel. ←/→(or↑/↓whenorientation="vertical") move focus between triggers;activationMode="automatic"(the default) activates the focused tab immediately,"manual"waits forEnter/ a click.Tabenters and leaves the tablist as a single stop.- A
disabledtrigger is skipped by arrow-key navigation and unclickable. - RTL is honored via the document
dir. - The indicator slides over
--duration-normalon--ease-emphasized; underprefers-reduced-motion: reduceit jumps to the new tab instead.
Changelog
- #464
No computed-style read on mount in production: the RTL direction check runs in development only
- #447
growgives every item an even share of the row
- #378
The
filled,light,outline,subtleanddefaultvariants are replaced byunderline(the new default) andenclosedon a full-width baseline; useSegmentGroupfor the pill look - #378
Give one tab its own palette with
coloronTabs.Triggeror adataitem; the underline recolors as it slides - #378
The active tab is marked in the server HTML before hydration
- #389
The sliding indicator holds still under reduced motion, and a consumer
classNameoverrides the part's own utilities
- #109
The sliding indicator matches SegmentGroup's, and the default variant tints with
--c-solid
- #60
New Tabs component, with a sliding pill indicator
Stacking
One z-index scale for every floating surface — and why an overlay opened inside a Modal or Drawer needs no z-index at all.
Steps
A stepper for multi-step flows on Ark UI's Steps machine — numbered steps joined by connectors that fill as the flow advances, a content panel per step, a completed panel, and Prev/Next buttons.