Orbit
Segmented Control
Source
A compact row of mutually exclusive options for switching between views or modes.
Basic
A controlled control switching between three options.
const [value, setValue] = useState('grid')
const options = [
{ value: 'grid', label: 'Grid' },
{ value: 'list', label: 'List' },
{ value: 'board', label: 'Board' },
]
<SegmentedControl options={options} value={value} onChange={setValue} />Sizes
Three sizes adjust padding and text size.
<SegmentedControl options={options} value={value} onChange={setValue} size="sm" />
<SegmentedControl options={options} value={value} onChange={setValue} size="md" />
<SegmentedControl options={options} value={value} onChange={setValue} size="lg" />Tabs variant
The tabs variant fills the available width and distributes segments evenly, suited to section navigation.
<SegmentedControl
options={options}
value={value}
onChange={setValue}
variant="tabs"
/>Props
The selectable segments, rendered left to right.
The currently selected option value.
Called with the value of the segment that was clicked.
Controls padding and text size.
default is a compact inline control. tabs fills its container and grows each segment evenly.
className
stringMerged onto the container via tailwind-merge.