SegmentedControl
A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button. Within the control, all segments are equal in width. Like buttons, segments can contain text or images. Segmented controls are often used to display different views.
Import
Usage
Basic usage of SegmentedControl
and ControlSegment
.
Editable Example
Sizes
The default size is md
but it's possible to use sm
and lg
versions using the size
prop.
Editable Example
Editable Example
Props
SegmentedControl Props
SegmentedControl
composes the RadioButtonGroup
component but excludes the spacing
and inline
props.
Name | Type | Default | Description |
---|---|---|---|
id | string | The id of the checkbox group. | |
name | string | The name of the input field in a radio (useful for form submission). | |
defaultValue | string | The initial value of the radio group. | |
value | RadioProps['value'] | The value of the radio group. | |
onChange | function | The callback fired when any children Radio is checked. |
ControlSegment Props
Name | Type | Default | Description |
---|---|---|---|
value | string or number | The value to be used for the segment. This is the value that will be returned on form submission. | |
disabled | boolean | If true , the segment will be disabled. | |
loading | boolean | If true , a spinner will be displayed before any child elements. | |
children | React.ReactNode | The child elements. | |
icon | IconProps['name'] | An icon to display before any children. | |
iconSize | IconProps['size'] | The size of the icon to display before any children. |