Example
Add role="switch" to a checkbox to indicate it represents an on/off setting that takes effect immediately, rather than a form field awaiting submission.
Switches let users toggle a single setting on or off immediately, without needing to submit a form to see the state change.
Add role="switch" to a checkbox to indicate it represents an on/off setting that takes effect immediately, rather than a form field awaiting submission.
Add the disabled attribute to prevent a switch from being toggled or focused, and exclude its value from form submission.
Associate a switch with helper text using aria-describedby, so users understand what the setting controls before toggling it.
You can indicate the validation state of the switch using the attribute aria-invilid with the values true and false.