Switch
A native switch whose thumb slides on a light spring and stretches while pressed, with optional icons and a pending state for settings that save to a server.
pixikit.com/docs/components/switch
Customize
Default checked
Side
Size
Icons
Pending
Disabled
Props
12| Name | Type | Default | Description |
|---|---|---|---|
checked | boolean | None | Whether it is on, when you hold the state. |
defaultChecked | boolean | false | Whether it starts on, when the switch holds the state. |
onCheckedChange | (checked: boolean) => void | None | Called with the new state when the user flips it. |
label | string | None | The text next to the switch. Clicking it flips the switch. |
description | string | None | A line of help under the label. |
side | "start" | "end" | "start" | Which side of the text the switch is on. |
size | "sm" | "md" | "lg" | "md" | The size of the switch. |
icons | boolean | false | Shows a check and a cross inside the thumb that cross-fade as it moves. |
pending | boolean | false | Shows a spinner in the thumb and ignores clicks, for a setting that is saving. |
disabled | boolean | false | Turns the switch off. |
name | string | None | The field name sent with a form. |
className | string | None |