Tabs
A headless tab primitive with roving focus, automatic or manual keyboard activation, disabled tabs, and panel composition.
Anatomy
Give every Tabs.Tab a unique value and pair it with a Tabs.Panel carrying the same value. The optional Tabs.Indicator tracks the active tab through CSS variables (--active-tab-left, --active-tab-top, --active-tab-width, --active-tab-height) so it can animate between tabs.
<script>
import { Tabs } from '@human-kit/ui';
</script>
<Tabs.Root defaultValue="overview">
<Tabs.List aria-label="Account sections">
<Tabs.Tab value="overview">Overview</Tabs.Tab>
<Tabs.Tab value="billing">Billing</Tabs.Tab>
<Tabs.Indicator />
</Tabs.List>
<Tabs.Panel value="overview">Overview content</Tabs.Panel>
<Tabs.Panel value="billing">Billing content</Tabs.Panel>
</Tabs.Root>Manual activation
By default arrow keys activate tabs as focus moves. With keyboardActivation="manual", arrow keys only move focus and the focused tab activates on Enter or Space — useful when switching panels is expensive.
Vertical orientation and disabled tabs
Set orientation="vertical" to stack the tab list and switch arrow-key navigation to Up/Down. Pass disabledKeys on Tabs.Root (or disabled on a single Tabs.Tab) to keep specific tabs from being activated.
Usage guidelines
- Provide a unique
valuefor everyTabs.Taband matchingTabs.Panel. - Use
value/onChangefor controlled state anddefaultValuefor uncontrolled state. - Set
defaultValue={null}when no tab should be active initially. - Use
keyboardActivation="manual"when panel activation is expensive or should wait for Enter/Space. - Use
orientation="vertical"for vertical tab lists. - Use
forceMountonTabs.Panelwhen inactive panel state must be preserved in the DOM.
Accessibility
Tabs.Listrendersrole="tablist"and mirrors the configured orientation.Tabs.Tabrenders button semantics withrole="tab",aria-selected, andaria-controls.Tabs.Panelrendersrole="tabpanel"andaria-labelledby.- Arrow keys move focus within the tab list, Home/End jump to the first or last enabled tab, and focus wraps at the ends.
API reference
Root
The tabs container. Holds the selected value and provides context to the list, tabs, indicator, and panels.
* required. Native HTML attributes of the underlying element are also accepted.
List
The tab strip. Renders role="tablist" and manages roving focus between tabs.
* required. Native HTML attributes of the underlying element are also accepted.
Tab
A single tab button. Renders role="tab" with aria-selected and aria-controls pointing at its panel.
* required. Native HTML attributes of the underlying element are also accepted.
Indicator
An optional visual marker for the active tab. Measures the active tab and exposes its position and size through the --active-tab-left/top/width/height CSS variables.
* required. Native HTML attributes of the underlying element are also accepted.
Panel
The content associated with a tab. Renders role="tabpanel" with aria-labelledby, and is hidden while its tab is inactive.
* required. Native HTML attributes of the underlying element are also accepted.