Segmented
Base UIRuled buttons for choosing one option from a few.
Install
$ npx shadcn@latest add https://spotcheckui.com/r/segmented.jsonAlso installs @base-ui/react.
Usage
import { Segmented } from "@/components/spotcheck/segmented"
<Segmented label="Range" options={["Day", "Week", "Month"]} value={range} onValueChange={setRange} />One option always stays selected, so pressing the current one does nothing.
Props
- label * Required
stringDefault —Names the group for screen readers. - options * Required
string[]Default — - value
stringDefault —The selected option, when you control it. - defaultValue
stringDefault —The starting option, when it manages itself. - onValueChange
(value: string) => voidDefault — - className
stringDefault —
Keyboard
| ← → | Move between options |
|---|---|
| Space | Choose the focused option |
Reduced motion
Nothing here animates.