Tabs
Switches between views of the same thing on one page.
In Multi-brand
See it live
npm run storybookWhen to use it
In Multi-brand: Sections of the account.
- Use it when: Related views of one object that people move between.
- Not when: Navigation to other pages (links), or steps of a task (progress).
Instead:
- Accordion: Stacked sections people can open together.
- Navigation menu: Other pages.
Words
- Shared structure: object, state, next step.
- Brand tone lives in headlines and marketing copy, not in errors.
- Errors and confirmations read the same in every brand.
- Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Cancelcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Get started
See Voice and tone for the whole voice.
Accessibility and keyboard
| Keyboard | What happens | Not |
|---|---|---|
| undefined | Arrow keys move between tabs; Tab moves into the panel. | undefined |
Test before you ship:
- It is a tablist; the selected tab owns its panel. undefined
Use it in code
npx open-ds add tabs
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Tabs reads 14 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Tabs's tokens to change Tabs alone.
Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Shared | ||
| Button focus ring Changes with theme on focus | component.button.focus-ringcolor.border.focusvar(--button-focus-ring) | Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F |
| Tabs | ||
| Indicator Changes with theme | component.tabs.indicatorcolor.action.primaryvar(--tabs-indicator) | Aster Lightteal.light.600:#0F766EAster Darkteal.dark.600:#7FCFC6Birch Lightpurple.light.600:#6D28D9Birch Darkpurple.dark.600:#B79DF7Coral Lightorange.light.600:#C2410CCoral Darkorange.dark.600:#F7A67F |
| Focus on focus | component.tabs.focusborder-width.focusvar(--tabs-focus) | border-width.2:2px |
| Canvas Changes with theme on focus | component.tabs.canvascolor.surface.canvasvar(--tabs-canvas) | Aster Lightslate-deep.light.50:#F8FAFCAster Darkslate-deep.dark.0:#020617Birch Lightslate-deep.light.50:#F8FAFCBirch Darkslate-deep.dark.0:#020617Coral Lightslate-deep.light.50:#F8FAFCCoral Darkslate-deep.dark.0:#020617 |
| Text | ||
| Color Changes with theme | component.tabs.labelcolor.text.secondaryvar(--tabs-label) | Aster Lightslate-deep.light.700:#334155Aster Darkslate-deep.dark.500:#CBD5E1Birch Lightslate-deep.light.700:#334155Birch Darkslate-deep.dark.500:#CBD5E1Coral Lightslate-deep.light.700:#334155Coral Darkslate-deep.dark.500:#CBD5E1 |
| Active Changes with theme | component.tabs.label.activecolor.text.primaryvar(--tabs-label-active) | Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC |
| List | ||
| Gap | component.tabs.list.gapspace.gap.groupvar(--tabs-list-gap) | space.24:1.5rem |
| Border width | component.tabs.list.border-widthborder-width.defaultvar(--tabs-list-border-width) | border-width.1:1px |
| Border Changes with theme | component.tabs.list.bordercolor.border.defaultvar(--tabs-list-border) | Aster Lightslate-deep.light.200:#E2E8F0Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.200:#E2E8F0Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.200:#E2E8F0Coral Darkslate-deep.dark.100:#1E293B |
| Trigger | ||
| Height | component.tabs.trigger.heightsize.control.defaultvar(--tabs-trigger-height) | size.44:2.75rem |
| Font family Changes with theme | component.tabs.trigger.font-familytype.label.font-familyvar(--tabs-trigger-font-family) | Aster Lightfont.family.inter:Inter, system-ui, sans-serifAster Darkfont.family.inter:Inter, system-ui, sans-serifBirch Lightfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifBirch Darkfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifCoral Lightfont.family.poppins:Poppins, system-ui, sans-serifCoral Darkfont.family.poppins:Poppins, system-ui, sans-serif |
| Text size | component.tabs.trigger.font-sizetype.label.font-sizevar(--tabs-trigger-font-size) | font.size.14:0.875rem |
| Weight | component.tabs.trigger.font-weighttype.label.font-weightvar(--tabs-trigger-font-weight) | font.weight.600:600 |
| Content | ||
| Padding, top | component.tabs.content.padding-topspace.gap.defaultvar(--tabs-content-padding-top) | space.12:0.75rem |