Switch

Switches toggle the selection of an item on and off.

Props

React props
NameTypeRequiredDefaultDescription
classNamestring | Partial<Record<"switch" | "icon" | "stateLayer" | "handle" | "handleContainer", string>> | ClassNameComponent<SwitchInterface>No—Root classes (string), static element classes (object), or state-aware element classes (function).
defaultCheckedbooleanNofalseUncontrolled mode: initial checked state.
checkedbooleanNo—Controlled mode: explicitly control whether the switch is on.
activeIconIconNo—Icon shown inside the thumb while checked.
inactiveIconIconNo—Icon shown inside the thumb while unchecked.
disabledbooleanNofalsePrevents interaction.
onCheckedChange(checked: boolean) => voidNo—Called once for each accepted checked-state transition.