Segmented control
A pill-shaped choice of two or three: the selected item is ink.
HTML
<div class="bm-stage" style="flex-direction:column;gap:var(--space-5)">
<div class="bm-rowx" style="gap:var(--space-6)">
<div class="bm-seg" role="radiogroup" aria-label="Stop by"><button class="bm-seg__item" role="radio" aria-checked="true">Time</button><button class="bm-seg__item" role="radio" aria-checked="false">Weight</button></div>
<div class="bm-seg" role="radiogroup" aria-label="Dashboard"><button class="bm-seg__item" role="radio" aria-checked="false">Simple</button><button class="bm-seg__item" role="radio" aria-checked="true">Advanced</button><button class="bm-seg__item" role="radio" aria-checked="false">Customize</button></div>
<div class="bm-seg" role="radiogroup" aria-label="Theme"><button class="bm-seg__item" role="radio" aria-checked="false"><span data-icon="monitor" data-size="18"></span>System</button><button class="bm-seg__item" role="radio" aria-checked="false"><span data-icon="sun" data-size="18"></span>Light</button><button class="bm-seg__item" role="radio" aria-checked="true"><span data-icon="moon" data-size="18"></span>Dark</button></div>
<div class="bm-seg" role="radiogroup" aria-label="Stop by"><button class="bm-seg__item" role="radio" aria-checked="true">Time</button><button class="bm-seg__item" role="radio" aria-checked="false" disabled>Weight</button></div>
</div>
<div class="bm-rowx" style="gap:var(--space-6);align-items:flex-start">
<section class="bm-tile" style="width:296px"><span class="bm-eyebrow">Favourites at 320 px</span><div class="bm-seg bm-seg--scroll" role="radiogroup" aria-label="Favourite profiles"><button class="bm-seg__item" role="radio" aria-checked="true"><span class="bm-seg__label">First</span></button><button class="bm-seg__item" role="radio" aria-checked="false"><span class="bm-seg__label">Adaptive v2</span></button><button class="bm-seg__item" role="radio" aria-checked="false"><span class="bm-seg__label">Crème brûlée, slow bloom for light roasts</span></button><button class="bm-seg__item" role="radio" aria-checked="false"><span class="bm-seg__label">Turbo</span></button></div><p class="bm-help">The track scrolls. A long name truncates at 176 px.</p></section>
<section class="bm-tile" style="width:296px"><span class="bm-eyebrow">Sharing a row</span><div class="bm-seg bm-seg--block" role="radiogroup" aria-label="Theme"><button class="bm-seg__item" role="radio" aria-checked="true">System</button><button class="bm-seg__item" role="radio" aria-checked="false">Light</button><button class="bm-seg__item" role="radio" aria-checked="false">Dark</button></div><div class="bm-cell"><span class="bm-eyebrow">Inside a cell</span><div class="bm-seg bm-seg--block bm-seg--on-tile" role="radiogroup" aria-label="Stop by"><button class="bm-seg__item" role="radio" aria-checked="true">Time</button><button class="bm-seg__item" role="radio" aria-checked="false">Weight</button></div></div></section>
</div>
</div>- Use Segmented for mutually exclusive settings that apply at once: stop by time or weight, theme, Simple or Advanced.
- Two or three items, each one word. More than three becomes a Select or a ListRow that opens a list.
- On a tile, the track is
surface-2; inside a cell usebm-seg--on-tile. - Names you do not control, such as favourite profiles, use
bm-seg--scroll: each item keeps its own width up to 176 px, then truncates, and the track scrolls sideways instead of squeezing or wrapping. Wrap the name in.bm-seg__label. Keep the selected item scrolled into view. - The mode bar is built on the same idea and has its own card, ModeBar.
Anatomy
.bm-seg is a 44 px track with space-1 of padding; each .bm-seg__item is a 36 px pill, at least 44 px wide, with its label in label and an optional 18 px icon. An item's hit area fills the track's full height, so the target is 44 px even though the pill is 36. bm-seg--block shares a row's width equally.
States
| State | Fill | Label |
|---|---|---|
| Rest | none | ink-muted |
| Hover, pressed | state-hover | ink |
| Selected | ink | on-ink |
| Disabled | none | ink-faint |
| Focus | the focus ring, inside the track's padding |
The fill changes in duration-fast. Nothing slides.
Content
- A fixed option is one word of at most 10 characters; three of them fit a 320 px screen.
- Always have exactly one selected. A choice that can be empty is not a Segmented control.
Keyboard and screen reader
- For a setting, mark the track
role="radiogroup"with anaria-labeland each itemrole="radio"witharia-checked; arrow keys move and select, and Tab enters and leaves the group once. - For a pair of views or filters, plain buttons with
aria-pressedin arole="group"are enough; each is a Tab stop. - Choosing applies at once. If applying can fail (switching profile while offline), keep the old selection and raise a Toast.