Switch
Turn a setting on or off, applied immediately rather than on save.
A Switch takes effect immediately. If the surface has a Save button, the control belongs to that form and should be a Checkbox instead — a switch that does not apply until later is a broken promise.
States
Controlled only. Give it an aria-label, or a Label paired by id — the track has no text of its own.
Props
Switch
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | — | Required. The controlled state. |
onCheckedChange | (checked: boolean) => void | — | Called with the next state. |