Skip to main content

Tabs

Tabbed content interface that switches between related content panels within the same page region. Reach for tabs when several panels of content share context but only one needs to be visible at a time - a specification sheet, a settings screen, or a mission briefing split into overview, crew, and timeline.

Usage​

When to use

  • Grouping related content into parallel panels
  • Saving vertical space when content sections are mutually exclusive
  • Settings, profile sections, or product detail breakdowns

When not to use

  • Content users need to compare side-by-side
  • Sequential steps - use a stepper or form pagination
  • When users may want to print or search all panels at once - use headings with an accordion instead

Do

  • Give each tab a short, scannable label
  • Keep the number of tabs small enough to fit without scrolling
  • Preserve the active tab state on reload where it makes sense

Don't

  • Nest tabs inside tabs
  • Hide primary navigation behind a tab
  • Use tabs when content order matters (first, then, finally)

API​

Props​

PropTypeDefaultDescription
panelsarray-Array of {title, content} panel objects. Each panel renders a tab button and a tabpanel.
linksarray-Optional array of custom label strings to override auto-generated tab labels from panel titles.
tabs_idstring-Base for the generated tab and panel ids ("{tabs_id}-tab-{n}" / "{tabs_id}-panel-{n}"). Defaults to "tabs"; set a unique value when a page renders more than one tabs instance.
classesarray-Additional CSS class words merged into the root element.
attributesobject-Additional HTML attributes spread on the root element.

Classes​

ClassCapabilityDefaultDescription
.subtleEmphasis-Lower emphasis; a muted, quieter weight.
.neutralEmphasisYesDefault emphasis; the standard weight at balanced contrast.
.accentEmphasis-Higher emphasis; a stronger, louder weight.
.solidFill-Filled surface; background and border rendered.
.outlineFill-Bordered surface; transparent background.
.ghostFill-No surface; text or icon only.
.smSize-Small.
.mdSizeYesMedium.
.lgSize-Large.
.fillFit-Content stretches to fill the box, may distort (object-fit: fill).
.fluidLayout-Full-width, no max-width.
.horizontalOrientationYesChildren flow along the horizontal axis.
.verticalOrientation-Children flow along the vertical axis.
.animatedMotionYesHonors the animations option.
.stillMotion-Forces motion off regardless of the option.

Attributes​

AttributeSet byRequiredDescription
data-tabsConsumerYesMarks the tabs root. Required for the JS to wire up the tablist, tabs, and tabpanels.

Examples​

Horizontal​

Horizontal tab bar with underline indicator and panels below.

Auto-generated horizontal​

Horizontal tabs generated automatically from each panel title.

Vertical​

Tabs stacked on the left with panels on the right.

Auto-generated vertical​

Vertical tabs generated automatically from each panel title.

Accessibility​

  • WCAG 2.2 AA
  • Full keyboard support: Tab moves focus in and out of the tablist; Left/Right (or Up/Down for vertical) move between tabs; Home/End jump to first/last tab
  • Only one tab at a time is reachable via Tab - arrow keys move within the tablist
  • Active tab is programmatically indicated to assistive technology
  • Each panel is labeled by its corresponding tab
  • accordion - alternative reveal pattern for sequential or searchable content