Selection

Segmented control

Radio inputs in one tinted track; the chosen one is a raised thumb.

Examples

Segmented

Full width · data-fill

Anatomy

.segmentedThe track: one tint, inset so the thumb sits inside it at the control height. Short of room, segments wrap onto another row instead of shrinking. Give it role="radiogroup" and an aria-label.
> labelOne per segment.
label > input[type=radio]Covers the segment, invisible. All inputs share a name.
label > spanThe segment: a bare, muted label. Checked, it is a thumb with a small shadow (the white surface in light, the press tint in dark), in text ink (tone ink under data-tone); under prefers-contrast: more it also takes the 2px edge. Under data-fill (up to six options, shared equally) the thumb glides from one choice to the next.

API

AttributeValuesDescription
data-sizeslOne control size smaller (s) or larger (l): height and type step together. Default sits between.
data-fillbooleanSpans the row instead of hugging its labels; the segments share it equally, their text centred. For inspectors and narrow panels.
checkedbooleanOn one input: the segment that starts selected. With none checked, no segment is on.
data-toneboolean

Accessibility

  • It is a native radio group, so screen readers announce "Week, radio button, 2 of 3" without extra markup.
  • role="radiogroup" with an aria-label names the group; the radios already group by name.
  • Focus draws the ring on the segment's span, not on the hidden input.
  • The checked segment never relies on colour alone: it also carries the 2px edge. In forced colours it takes the system highlight.
KeyEffect
← / →Moves the selection to the previous or next segment.
TabEnters the control at the checked segment; the control is one tab stop.
Jump to
ProportionFoundations
MaterialFoundations
PresetsFoundations
ShellLayouts · Application
Container and stacksLayouts · Pages
SplitLayouts · Pages
Grid, bento, masonryLayouts · Pages
Switcher and rowLayouts · Pages
↑↓Move↵OpenescClose