Skip to content
Statix Design System

Navigation

Tabs

Switches between panels of related content on one page, such as the sections of a website. Pick a style on Tabs.List: a quiet segmented control, a dark pill bar or nav-style underline tabs.

import * as Tabs from '@statix/ui/tabs';

Playground

Overview of yoga-berger.de
Controls
<Tabs.Root value="overview">
	<Tabs.List variant="pill" aria-label="yoga-berger.de">
		<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
		<Tabs.Trigger value="backups">Backups</Tabs.Trigger>
		<Tabs.Trigger value="updates">Updates</Tabs.Trigger>
		<Tabs.Trigger value="settings">Settings</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="overview">…</Tabs.Content>
	<Tabs.Content value="backups">…</Tabs.Content>
</Tabs.Root>

Examples

Default

A white segment on a bg-2 track. Use it for two or three short options inside a card, such as a billing period.

WordPress Hosting costs 19 € per month.
<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';
</script>

<Tabs.Root value="month" class="w-full max-w-md">
	<Tabs.List aria-label="Billing period">
		<Tabs.Trigger value="month">Monthly</Tabs.Trigger>
		<Tabs.Trigger value="year">Yearly</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="month" class="text-ink-2"
		>WordPress Hosting costs 19 € per month.</Tabs.Content
	>
	<Tabs.Content value="year" class="text-ink-2">
		WordPress Hosting costs 190 € per year. You save two months.
	</Tabs.Content>
</Tabs.Root>

Pill

The dark segmented bar from the website detail page. Use it for the main sections of one object.

yoga-berger.de is online. WordPress 6.7, PHP 8.3.
<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';
</script>

<Tabs.Root value="overview" class="w-full max-w-2xl items-start">
	<Tabs.List variant="pill" aria-label="yoga-berger.de">
		<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
		<Tabs.Trigger value="backups">Backups</Tabs.Trigger>
		<Tabs.Trigger value="updates">Updates</Tabs.Trigger>
		<Tabs.Trigger value="settings">Settings</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="overview" class="text-ink-2">
		yoga-berger.de is online. WordPress 6.7, PHP 8.3.
	</Tabs.Content>
	<Tabs.Content value="backups" class="text-ink-2">Last backup today at 03:10.</Tabs.Content>
	<Tabs.Content value="updates" class="text-ink-2">All plugins are up to date.</Tabs.Content>
	<Tabs.Content value="settings" class="text-ink-2">Domain, SSL and PHP version.</Tabs.Content>
</Tabs.Root>

Underline

Text tabs on a hairline with a 2px ink bar under the active tab. It reads like page navigation and suits long labels.

yoga-berger.de is online. WordPress 6.7, PHP 8.3.
<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';
</script>

<Tabs.Root value="overview" class="w-full max-w-2xl">
	<Tabs.List variant="underline" class="w-full" aria-label="yoga-berger.de">
		<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
		<Tabs.Trigger value="backups">Backups</Tabs.Trigger>
		<Tabs.Trigger value="updates">Updates</Tabs.Trigger>
		<Tabs.Trigger value="settings">Settings</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="overview" class="text-ink-2">
		yoga-berger.de is online. WordPress 6.7, PHP 8.3.
	</Tabs.Content>
	<Tabs.Content value="backups" class="text-ink-2">Last backup today at 03:10.</Tabs.Content>
	<Tabs.Content value="updates" class="text-ink-2">All plugins are up to date.</Tabs.Content>
	<Tabs.Content value="settings" class="text-ink-2">Domain, SSL and PHP version.</Tabs.Content>
</Tabs.Root>

With counts

Put a Tabs.Count inside the trigger to show how many items wait in each queue. The active count turns ink.

Contact form on yoga-berger.de sends no emails.
<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';

	const queues = [
		{
			value: 'open',
			label: 'Open',
			count: 4,
			text: 'Contact form on yoga-berger.de sends no emails.'
		},
		{
			value: 'waiting',
			label: 'Waiting for customer',
			count: 2,
			text: 'Jonas Weber asked for the new logo files.'
		},
		{ value: 'done', label: 'Done', count: 18, text: 'Mailbox info@yoga-berger.de was set up.' }
	];
</script>

<Tabs.Root value="open" class="w-full max-w-2xl">
	<Tabs.List variant="underline" class="w-full" aria-label="Support requests">
		{#each queues as queue (queue.value)}
			<Tabs.Trigger value={queue.value}>
				{queue.label}
				<Tabs.Count aria-label="{queue.count} requests">{queue.count}</Tabs.Count>
			</Tabs.Trigger>
		{/each}
	</Tabs.List>
	{#each queues as queue (queue.value)}
		<Tabs.Content value={queue.value} class="text-ink-2">{queue.text}</Tabs.Content>
	{/each}
</Tabs.Root>

Vertical

Set orientation="vertical" on Tabs.Root for settings pages with a side list.

Laura Berger, laura@yoga-berger.de
<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';
</script>

<Tabs.Root value="account" orientation="vertical" class="w-full max-w-2xl">
	<Tabs.List variant="underline" aria-label="Settings">
		<Tabs.Trigger value="account">Account</Tabs.Trigger>
		<Tabs.Trigger value="payment">Payment methods</Tabs.Trigger>
		<Tabs.Trigger value="contracts">Contracts</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="account" class="text-ink-2">Laura Berger, laura@yoga-berger.de</Tabs.Content>
	<Tabs.Content value="payment" class="text-ink-2">Direct debit, IBAN ending in 4410.</Tabs.Content>
	<Tabs.Content value="contracts" class="text-ink-2"
		>WordPress Hosting, renews on 1 March.</Tabs.Content
	>
</Tabs.Root>

Narrow screens

Pill and underline lists scroll sideways when they run out of room. The active tab scrolls into the middle; the page itself does not move.

<script lang="ts">
	import * as Tabs from '@statix/ui/tabs';
</script>

<div class="w-full max-w-xs">
	<Tabs.Root value="invoices">
		<Tabs.List variant="pill" aria-label="Customer area">
			<Tabs.Trigger value="start">Start</Tabs.Trigger>
			<Tabs.Trigger value="websites">Websites</Tabs.Trigger>
			<Tabs.Trigger value="email">E-Mail</Tabs.Trigger>
			<Tabs.Trigger value="domains">Domains</Tabs.Trigger>
			<Tabs.Trigger value="invoices">Invoices</Tabs.Trigger>
		</Tabs.List>
	</Tabs.Root>
</div>

Guidelines

Do

  • Keep labels to one or two words: "Overview", "Backups", "Settings".
  • Use pill for the sections of a website, mailbox or domain. Use underline when labels are long or carry counts.
  • Give Tabs.List an aria-label that names the object, for example the domain.

Don't

  • Do not use tabs to move between pages. Use links in the nav bar instead.
  • Do not hide content the customer needs to compare side by side behind different tabs.
  • Do not mix two tab styles on one screen.

Accessibility

  • Follows the WAI-ARIA tabs pattern: role="tablist", role="tab" with aria-selected and role="tabpanel" with aria-labelledby.
  • Arrow keys move between tabs (left/right, or up/down when vertical), Home and End jump to the ends. Disabled tabs are skipped.
  • Tabs activate on focus by default. Pass activationMode="manual" to Tabs.Root to require Enter or Space.
  • Give a Tabs.Count an aria-label like "4 requests" when the number alone is unclear.

API reference

Tabs.Root

renders <div> and accepts its attributes

Holds the selected value and the orientation.

PropTypeDefault
value bindstring

The selected tab.

–
onValueChange (value: string) => void

Called when the selected tab changes.

–
orientation 'horizontal' | 'vertical'

Layout and arrow-key direction.

'horizontal'
activationMode 'automatic' | 'manual'

automatic selects on focus, manual waits for Enter or Space.

'automatic'
loop boolean

Arrow keys wrap around.

true
disabled boolean

Disables all tabs.

false
ref bindHTMLDivElement | null

The root element.

–
class ClassValue

Merged with the root classes.

–
Data attributeMeaning
data-slot="tabs"Always present.
data-orientation"horizontal" or "vertical".

Tabs.List

renders <div role="tablist"> and accepts its attributes

Wraps the triggers and sets the style for all of them.

PropTypeDefault
variant 'default' | 'pill' | 'underline' | 'line'

Visual style. line is the shadcn name and renders as underline.

'default'
ref bindHTMLDivElement | null

The list element.

–
class ClassValue

Merged with the variant classes; yours win.

–
Data attributeMeaning
data-slot="tabs-list"Always present.
data-variantThe current style. Triggers read it through the group/tabs-list group.

Tabs.Trigger

renders <button role="tab"> and accepts its attributes
PropTypeDefault
value * string

The value this tab selects.

–
disabled boolean

Skips and greys out the tab.

false
ref bindHTMLButtonElement | null

The button.

–
class ClassValue

Merged with the trigger classes.

–
Data attributeMeaning
data-slot="tabs-trigger"Always present.
data-state"active" or "inactive".
data-disabledPresent when disabled.

Tabs.Count

renders <span> and accepts its attributes

Statix addition. A small count badge inside a trigger. It turns ink on the active tab.

PropTypeDefault
ref bindHTMLSpanElement | null

The badge.

–
class ClassValue

Merged with the badge classes.

–
Data attributeMeaning
data-slot="tabs-count"Always present.

Tabs.Content

renders <div role="tabpanel"> and accepts its attributes
PropTypeDefault
value * string

Shown when this value is selected.

–
ref bindHTMLDivElement | null

The panel.

–
class ClassValue

Merged with the panel classes.

–
Data attributeMeaning
data-slot="tabs-content"Always present.
data-state"active" or "inactive".

tabsListVariants

The tailwind-variants function behind Tabs.List.