Skip to content
PixiKit

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
NameTypeDefaultDescription
checkedbooleanNoneWhether it is on, when you hold the state.
defaultCheckedbooleanfalseWhether it starts on, when the switch holds the state.
onCheckedChange(checked: boolean) => voidNoneCalled with the new state when the user flips it.
labelstringNoneThe text next to the switch. Clicking it flips the switch.
descriptionstringNoneA 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.
iconsbooleanfalseShows a check and a cross inside the thumb that cross-fade as it moves.
pendingbooleanfalseShows a spinner in the thumb and ignores clicks, for a setting that is saving.
disabledbooleanfalseTurns the switch off.
namestringNoneThe field name sent with a form.
classNamestringNone

More forms components in Pro

View all

Related