Skip to content

Forms

Segmented Control

A compact single-select built on native radios.

stableNo JS requiredBuilt on <input type="radio">hydrateless/segmented.css

A compact single-select control built on native radios under role="radiogroup". The radios give you keyboard navigation and form semantics for free. No JavaScript.

Playground

Live

Props

The framework bindings expose these props (and forward the rest to the root element).

PropTypeDefaultDescription
options{ label: string; value: string }[]The selectable segments.
valuestringControlled value; pair with `onValueChange`.
size'sm' | 'md' | 'lg''md'Control height and font size.

CSS variables

Override these on any ancestor to theme the component. See the theme studio to preview changes live.

CSS variableUsed for
--hl-surfaceTrack background.
--hl-bgSelected segment background.
--hl-radius-mdCorner radius.

Accessibility

  • Native radios share a name, so only one segment can be selected at a time.
  • Arrow keys move the selection, matching the radio group pattern.

Released under the MIT License.