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).
Use px on SegmentedControlOption to control horizontal padding. Accepts "md" (default) or "sm".
Use the icon prop on SegmentedControlOption to display an icon before the label.
Icon-only options work well for compact controls. Omit the label prop to show only the icon. Always provide an aria-label for accessibility when there is no visible text.
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 |
|---|