The Switch component is used to switch between two options and the result of the change is immediate.
The Switch
component is used as an alternative for the Checkbox
component.
Except indeterminate
and label
are not supported.
The Switch
will work with any height
you pass it. Although it’s only ever used with: 16
, 20
and 24
.
The Switch
component passes on the original event through the onChange
handler.
Use e.target.checked
to get the latest value and update state accordingly.