Toggle is similar to a two-option radio group in function but is used for quickly switching between binary actions. Toggle must always be accompanied by a label, and follows the same keyboard workflow as a checkbox.
Alternatives
Usage
A control used to quickly switch between two possible states. Toggles are only for binary actions that occur immediately after the user “flips” the toggle switch.
Do not use in forms — or other workflows that have "submit" behaviour.
Controlled
The toggle is a controlled component, you must provide a checked
state and
onChange
handler.
A11y text
You may change the accessibility text, provided to screen readers, based on the
context of the toggle. The default text is on/off
.