Switcher

Switcher component used as an alternative of the single Checkbox, it can be switch between enabled or disabled.

Basic

Basic example for Switcher.

Content

Switcher can have different content on state enabled or disabled

Disabled

Set disabled to true to disable the Switcher.

Loading

We can set isLoading prop to true and make Switcher status to pending.

Colors

We can apply custom color to Switcher via switcherClass prop.

Controlled

Controlled example.

API

Switcher
PropDescriptionTypeDefault
checkedWhether the Switcher is checkedboolean-
checkedContentContent to be shown when the state is checkedstring | ReactNode-
defaultCheckedWhether the Switcher initial state is checkedboolean-
disabledWhether the Switcher is disabledboolean-
isLoadingWhether the checkbox is loadingbooleanfalse
labelRefRef of Checkbox label elementstring-
nameThe name of the switcher input fieldstring-
onChangeCallback when Switcher value is changed(checked: boolean, e: MouseEvent) => void-
readOnlyWhether the Switcher is read onlyboolean-
switcherClassCustom css for Switcher toggledstring-
unCheckedContentContent to be shown when the state is uncheckedstring | ReactNode-