Selection
Segmented control
A pill of two to five segments with exactly one selected, used to switch the view below it or the kind of thing a form adds.
In kanso-ui as SegmentedButton
Variants and sizes
k-seg: as wide as its labels, for filters above a list.k-seg k-seg--fill: full width with equal segments, for forms and sheets on phones.
States
- Rest: an
ink-mutedlabel on the track. - Hover and pressed: the state layer at
state-hover(8%) andstate-pressed(12%). - Selected: the
outlineborder marks it, not only the fill, because the step fromsurface-sunkentosurfaceis faint.outlineholds 3.5:1 onsurfacein light and 5.1:1 in dark, and 3.0 / 4.5:1 against the track. The heavier label is a second cue. - Focus: the 2px
focus-ringaround the segment. - Disabled: there is none; leave out an option that does not apply.
Do and don’t
Do
Keep labels to one word, in sentence case.
Start with a sensible choice selected: "All", "Payment".
Use
k-seg--fillin forms and on phones.
Don’t
Use more than five segments, or leave none selected.
Use a segment to run an action.
What you provide
- Items: two to five, each a label and a value.
- The selected value and a change handler.
- The group's name.
- The width: fit or fill.