SegmentedControl
import { SegmentedControl } from "@study/ui"
Result
Loading...
Live Editor
function Example() { const [theme, setTheme] = useState("system"); return ( <SegmentedControl label="Appearance" value={theme} onChange={setTheme} options={[ { value: "light", label: "Light", icon: "sun" }, { value: "dark", label: "Dark", icon: "star" }, { value: "system", label: "System", icon: "settings" }, ]} /> ); }
Variants and states
Light
Dark
When to use
✓ DoFew options, all visible, one applies.
✗ Don'tMore than four – then a Select.
For switching between areas of a page there are Tabs.
Props
| Prop | Type | Default | Meaning |
|---|---|---|---|
label * | string | – | What is chosen, for screen readers. |
onChange * | (value: T) => void | – | |
options * | Segment<T>[] | – | |
value * | string | – | |
className | string | – | |
iconsOnly | boolean | – | Shows only the icons; the labels stay for screen readers. |
size | "sm" | "md" | md |
Accessibility
- Real radio buttons in a
radiogroup: arrow keys switch, Tab jumps in and out. - With
iconsOnly, the names remain for screen readers and as a tooltip.