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-muted label on the track.
  • Hover and pressed: the state layer at state-hover (8%) and state-pressed (12%).
  • Selected: the outline border marks it, not only the fill, because the step from surface-sunken to surface is faint. outline holds 3.5:1 on surface in 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-ring around 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--fill in 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.