Switch
A switch is a visual toggle between two mutually exclusive states — on and off.
Examples
Uncontrolled state
To use Switch in uncontrolled mode with an initial value, use the isDefaultChecked
prop.
Controlled state
Optionally, to use Switch in controlled mode, use the isChecked
and onCheckedChanged
props with your local state.
Helper text
The helperText
prop can be used to provide additional information about the input field below it.
Receive all account notifications via email.
API Reference
Prop | Default | Description |
---|---|---|
isChecked? | - | boolean If |
onCheckedChange? | - | ((isChecked: boolean) => void) |
isDefaultChecked? | - | boolean The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. |
isDisabled? | - | boolean If |
isRequired? | - | boolean If |
label | - | string The label for the switch |