All registry items
primitives/r/tonal-segmented-control.json
Tonal Segmented Control
Accessible pill switcher with Arrow/Home/End roving keyboard navigation.
Tonal Segmented Control
Toggle Tablet or Mobile for real isolated iframe breakpoints, or switch to Code for full source.
Selected range: 7d (try Left/Right arrow keys when focused)
Installation
npx shadcn@latest add https://tonal.harlo.dev/r/tonal-segmented-control.jsonDependencies
Tonal Registry Dependencies
npm Packages
clsxtailwind-merge
Usage
import { TonalSegmentedControl } from "@/components/tonal/segmented-control";
<TonalSegmentedControl
value={range}
onValueChange={setRange}
options={[{ value: "7d", label: "7D" }, { value: "30d", label: "30D" }]}
/>Props & Tokens API
| Prop | Type | Default | Description |
|---|---|---|---|
| options | SegmentedOption<T>[] | — | List of values, labels, optional icons & badges. |
| value | T | — | Controlled active option. |
| defaultValue | T | — | Initial uncontrolled active option. |
| onValueChange | (value: T) => void | — | Fires on click or arrow-key selection. |
| size | "sm" | "md" | "md" | Compact or regular pill density. |