Skip to main content

Switch API

Switch API#

Name RequiredTypeDefault ValueDescription
animationNoundefinedSwitch has built-in animations. Do not specify an animation.
biggerNobooleanSet true to make the control a little bit larger. For more control, use `font-size` in CSS on `.pretty`.
colorNo"primary" | "success" | "info" | "warning" | "danger"Choose a color. Note: solid colors only for switch.
hasFocusNobooleanSet true to enable focus styling.
lockedNobooleanSet true to enable locked mode.
plainNobooleanSet `true` to enable plain styles when to checkbox or radio is selected.
setStateNoDispatch<SetStateAction<string | boolean | any[]>>The state dispatch function either from the `setState` hook or a reference to `this.setState`.
shapeNo"fill" | "slim"The shape of the Switch.
stateNostring | boolean | any[]The state of the control. Typically a boolean, string, or string array.
typeNo"checkbox" | "radio"Override the kind of switch. Defaults to checkbox.
variantNostring