With a segmented control, users can toggle between different ways of formatting a piece of content or data.
Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of
label
.
Type: String
Required: No
Adds the specified classes to the root element of the component.
Type: String
Required: No
Adds the specified ID to the root element of the component.
Type: String
Required: No
Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible), this label is used as
aria-label
on the group of segments. In a narrow container, where this component is displayed as a select component, the label is visible and attached to the select component, unlessariaLabelledBy
is defined. Don't uselabel
andariaLabelledBy
at the same time.
Type: String
Required: No
An array of objects representing options. Each segment has the following properties:
id
(string) - The ID of the segment.disabled
[boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.iconName
(string) - (Optional) Specifies the name of the icon, used with the icon component.iconAlt
(string) - (Optional) Specifies alternate text for the icon when usingiconUrl
, oriconName
withouttext
. This is required when you use an icon withouttext
.iconUrl
(string) - (Optional) Specifies the URL of a custom icon.iconSvg
(ReactNode) - (Optional) Custom SVG icon. Equivalent to thesvg
slot of the icon component.text
(string) - (Optional) Specifies the text of the segment.
Type: ReadonlyArray<SegmentedControlProps.Option>
Required: No
ID of the selected option. If you want to clear the selection, use
null
.
Type: Null | string
Required: Yes
Called when the user selects a different segment.
Detail type:
SegmentedControlProps.ChangeDetail {
selectedId: string
}
Cancelable: No
The documentation is made available under the Creative Commons Attribution-ShareAlike 4.0 International License. See the LICENSE file.