A segmented control is a group of two or more options which function as mutually exclusive buttons. Within the control, all segments are equal width.
Segmented controls should:
Follow the content guidelines outlined in the button component.
Used to present mutually exclusive options as buttons.
Positioning of the label for the segmented control can be varied. Using the option "hidden"
will visually hide the label while still providing an accessible way for screen reader users to identify the related options.
Used to indicate to the user that an action is not currently available. Disabled buttons do not respond to user input (and therefore will not trigger onClick behavior).
Used to trigger an onClick
handler when an option is clicked. Does not conflict with onChange
.
Used to trigger an onKeyDown
handler with keyboard events. Does not conflict with onChange
.
To navigate and select with the keyboard, tab into the component and use arrow keys
and enter
within the component, as outlined in accessibility guidelines.