Segment
A sliding segmented control for mutually exclusive choices.
When to use
Use Segment when you need a sliding segmented control for mutually exclusive choices.
Import
TypeScript
import { Segment } from '@gzodo/ui'Segment is a compact switcher: one selected value, a sliding thumb, and Segment.Item children. Use it for theme, view mode, or short ranges. Prefer ButtonGroup when each option should look like a full button.
Examples
4Basic
Controlled
value and onChange. The thumb moves to the active item.Three options
Any number of items works. The thumb width follows the count.
Sizes
size is sm, md, lg, or xl.Full width
fullWidth stretches the control and shares space equally.Segment
7Segment
Property
Description
Type
Default
valueSelected item value.
string—
onChangeCalled when an item is chosen.
(value: string) => void—
sizeItem height and type size.
'sm' | 'md' | 'lg' | 'xl''md'fullWidthStretch to the parent width.
booleanfalsearia-labelAccessible name for the group.
string—
classNameClass on the root.
string—
childrenSegment.Item elements.
ReactNode—
Segment.Item
4Segment.Item
Property
Description
Type
Default
valueValue reported through onChange.
string—
childrenLabel, icon, or both.
ReactNode—
disabledBlocks selection.
booleanfalseclassNameClass on the item button.
string—