The Switch component provides a toggle control for binary states, featuring a sliding animation when toggled. It's commonly used for enabling or disabling features and settings.
Control the switch state with the checked prop. onToggle receives the state the switch moves to, so the setter can be passed straight in.
Leave out checked and the switch keeps its own state, starting from defaultChecked. onToggle still reports every change, and with a name the switch submits its value with a form.
Show a loading spinner while an action is being processed.
Disable the switch to prevent user interaction.
Place the switch on the right side of the label.