Skip to content
Storybook

Tabs

Switch between sections of related content. Underline for page sections, Pill for in-card switching.

Preview

React · live from the Storybook

HTML and CSS

The same component as plain HTML with pixels-ui.css, no framework needed.

Project summary, goals and key dates.

Usage

  • Tabs switch views; they do not navigate to other pages.

Installation

Included in the core files. No extra install.

HTML
<link rel="stylesheet" href="/css/pixels-tokens.css">
<link rel="stylesheet" href="/css/pixels-ui.css">
<script src="/js/pixels-ui.js" defer></script>

Examples

Pill

px-tabs--pill.

Visitors are up 12% this week.

API reference

Class / attributeTypeDescription
px-tabs · --pill · --smclassType and size.
data-px-tabsattributeClick + arrow keys + Home/End.
role="tablist|tab|tabpanel"attributeARIA wiring with aria-controls.

Figma properties

Tabs4 variants · page “Tabs”Open

Tab bar built from Tab instances. Underline spans the container with a hairline track; Pill hugs its tabs. RTL starts from the right. Wrap in role=tablist.

PropertyTypeValues
TypeVariantUnderline Pill
DirectionVariantLTR RTL
Tab40 variants · page “Tabs”Open

Single tab. Underline for page-level sections, Pill for compact in-card switching. role=tab with aria-selected; arrow keys move between tabs.

PropertyTypeValues
LabelText“Tab label”
IconBoolean—
Icon swapInstance swap—
CountBoolean—
TypeVariantUnderline Pill
SizeVariantSmall Medium
StateVariantActive Hover Focused Selected Disabled
DirectionVariantRTL LTR

Design tokens

Component tokens from the Figma Component collection. Override them to restyle just this component.

TokenAliasLight value
--px-table-header-backgroundcolor-surface-sunken#f9fafb
--px-table-header-contentcolor-content-neutral-secondary#475467
--px-table-bordercolor-border-neutral-subtle#f2f4f7
--px-table-contentcolor-content-neutral-secondary#475467
--px-table-radiusradius-1616px
--px-table-header-heightspacing-4040px
--px-table-row-heightspacing-5656px
--px-table-cell-padding-xspacing-2xl24px
--px-tab-indicatorcolor-border-brand-default#2563eb
--px-tab-height-smcontrol-height-sm32px
--px-tab-height-mdspacing-3232px
--px-tab-indicator-widthborder-width-md2px
--px-tab-radiusradius-88px
--px-tab-padding-xspacing-1212px
Show all 17 tokens
TokenAliasLight value
--px-tabs-list-paddingspacing-44px
--px-tabs-list-radiusradius-1212px
--px-tabs-list-gapspacing-44px

Accessibility

  • Arrow keys move between tabs (mirrored in RTL).
  • Only the selected tab is in the tab order.