A linear set of two or more segments, each of which functions as a mutually exclusive button. Use this when you want users to switch between different views or modes.
There are two variants, rectangular (default) and pill.
The Segmented Control comes in two sizes: md (32px, default) and lg (40px).
The Segmented Control comes in two widths: fit-content (default) and 100%.
Set isDisabled on the <SegmentedControl /> to disable all options.
Or set isDisabled on a specific <SegmentedControlOption />.
Just like the RadioGroup, the SegmentedControl supports generic types for values (numbers, objects, etc).
You can pass an icon or children to SegmentedControlOption to render more complex layouts.
| Name | Default | Description |
|---|---|---|
value | — | TThe value of the segmented control. |
onChange | — | (value: T) => voidCallback called when the value changes. |
isDisabled | — | booleanIf true, the segmented control will be disabled. |
name | — | stringThe name of the input field in a form. |
variant | — | SegmentedControlVariantVariants have different styling. |
width | — | "fit-content" | "100%"By default, will be as small as possible |
children | — | ReactNodeThe options to render. |
size | — | "md" | "lg" |
| Name | Default | Description |
|---|---|---|
value | — | TThe value of the option. |
label | — | ReactNodeThe label to display. |
status | — | "empty" | "success" | "error"The status of the option displayed as an icon. |
children | — | ReactNodeOptional element to display alongside label. |
isDisabled | — | boolean |