ToggleButton component uses a hidden native checkbox element as the switch element internally that is only visible to screen readers. Value to describe the component can be defined with aria-labelledby or aria-label props, it is highly suggested to use either of these props as the component changes the label displayed which will result in screen readers to read different labels when the component receives focus. To prevent this, always provide an aria label that does not change related to state.
Keyboard interaction is derived from the native browser handling of checkboxs in a group.
Key | Function |
---|---|
tab | Moves focus to the button. |
space | Toggles the checked state. |