Skip to content
Storybook

Segmented control

Switches between 2–5 views of the same content. The selected item is raised on a neutral track.

Preview

React · live from the Storybook

HTML and CSS

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

Usage

  • Use for switching views or modes, not for navigation.

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

Small

API reference

Class / attributeTypeDescription
px-segmentedclassTrack.
px-segmented__itemclassOption (button role="radio").
data-px-single="aria-checked"attributeSingle selection + arrow keys.

Figma properties

Segmented control4 variants · page “Toggles”Open

Switches between 2–5 views of the same content. Selected item is raised on a neutral track. RTL reverses item order.

PropertyTypeValues
SizeVariantSmall Medium
DirectionVariantLTR RTL
Segmented control / Item10 variants · page “Toggles”Open

One option inside a Segmented control.

PropertyTypeValues
LabelText“Label”
SizeVariantSmall Medium
StateVariantActive Hover Focused Disabled Selected

Design tokens

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

TokenAliasLight value
--px-segmented-paddingspacing-44px
--px-segmented-radiusradius-1212px
--px-segmented-item-radiusradius-88px
--px-segmented-gapspacing-22px
--px-segmented-item-height-mdspacing-3232px
--px-segmented-item-height-smspacing-2828px
--px-segmented-item-padding-xspacing-1212px
--px-segmented-item-gapspacing-88px

Accessibility

  • role="radiogroup" + role="radio"; arrow keys move and select.