Magoo Component UI logo Magoo Component UI
← Catalog

Segmented Control

segmented-control molecule experimental

An iOS-style single-select switch of pill segments for toggling between a few mutually exclusive views.

The width preview needs a screen wider than the chosen width — use a larger device (or a desktop browser) to see the desktop and tablet layouts.

Default
TwoWay

Props

NameTypeReq
label string
segments array ✓

Related components

How to use

The control is self-contained skeleton UI. Clicking a segment activates it and clears the others (data-active/aria-pressed), then dispatches a bubbling CustomEvent "segment:change" with { value }. Wire a listener to swap the content the control governs. The portable self-init reads each segment's data-value attribute; no props object is passed.

Use cases

controltoggle WCAG AA SEO 15 dir: both ai-generated