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? | - | booleanIf |
onCheckedChange? | - | ((isChecked: boolean) => void) |
isDefaultChecked? | - | booleanThe checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. |
isDisabled? | - | booleanIf |
isRequired? | - | booleanIf |
label | - | stringThe label for the switch |