List
Default to the inactive state.
Default to the active state.
Shown in disabled mode.
Icons
Pass icons as React.Node elements to the inactiveChild and activeChild props respectively.
Icons
Apply the compact prop to switch a minimal display.
Lightswitch
This is a full fledge example using multiple features.
API Reference
Switch
| Property | Type | Description |
|---|---|---|
name * | string | |
checked | boolean | |
disabled | boolean | |
compact | boolean | |
base | string | |
classes | string | |
stateFocused | string | |
controlBase | string | |
controlInactive | string | |
controlActive | string | |
controlDisabled | string | |
controlWidth | string | |
controlHeight | string | |
controlPadding | string | |
controlRounded | string | |
controlHover | string | |
controlClasses | string | |
thumbBase | string | |
thumbInactive | string | |
thumbActive | string | |
thumbRounded | string | |
thumbTranslateX | string | |
thumbTransition | string | |
thumbEase | string | |
thumbDuration | string | |
thumbClasses | string | |
labelBase | string | |
labelClasses | string | |
iconInactiveBase | string | |
iconActiveBase | string | |
onCheckedChange | (value: boolean) => void | |
inactiveChild | ReactNode | |
activeChild | ReactNode | |
children | ReactNode | |
ids | Partial<{ root: string; hiddenInput: string; control: string; label: string; thumb: string; }> | |
label | string | |
invalid | boolean | |
required | boolean | |
readOnly | boolean | |
form | string | |
value | string | number | |
dir | "ltr" | "rtl" | |
getRootNode | () => ShadowRoot | Node | Document | |