SegmentedControl
atomPill-style toggle group with an elevation-aware sliding indicator. Uses getBoundingClientRect with ResizeObserver for pixel-perfect positioning. Zero-padding track with 3px inset indicator. Focus ring only on keyboard navigation (:focus-visible).
Default
Three-option toggle with a sliding indicator.
Controlled
Controlled value with onChange callback.
Usage
Installation
API Reference
SegmentedControl props — * required
| Prop | Type | Default | Description |
|---|---|---|---|
options* | { value: string; label: string }[] | — | The available options. |
defaultValue | string | — | Initially selected value (uncontrolled). |
value | string | — | Selected value (controlled). |
onChange | (value: string) => void | — | Callback fired when the selection changes. |
size | "sm" | "md" | "lg" | "md" | Controls the height and font size of the control. |
fullWidth | boolean | false | Stretches the control to fill its container width. |
disabled | boolean | false | Disables all options. |