Switch

Switches toggle the selection of an item on and off.

Props

React props
NameTypeRequiredDefaultDescription
classNamestring | Partial<Record<"switch" | "stateLayer" | "icon" | "handle" | "handleContainer", string>> | ClassNameComponent<SwitchInterface>NoRoot classes (string), static element classes (object), or state-aware element classes (function).
defaultCheckedbooleanNofalseUncontrolled mode: initial checked state.
checkedbooleanNoControlled mode: explicitly control whether the switch is on.
activeIconIconNoIcon shown inside the thumb while checked.
inactiveIconIconNoIcon shown inside the thumb while unchecked.
disabledbooleanNofalsePrevents interaction.
onCheckedChange(checked: boolean) => voidNoCalled once for each accepted checked-state transition.