Skip to main content

Checkbox API

Checkbox API#

Name RequiredTypeDefault ValueDescription
animationNo"smooth" | "jelly" | "tada" | "rotate" | "pulse"Tne kind of animation to apply to the checkbox or radio.
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" | "primary-o" | "success-o" | "info-o" | "warning-o" | "danger-o"Choose a color (solid or outline) to apply to the control.
hasFocusNobooleanSet true to enable focus styling.
iconNoReactElement<any, "img" | "svg" | "i" | "em">The icon to pass (as JSX) to the checkbox or radio.
indeterminateNobooleanUnique to checkbox, set `true` when the checkbox is in `indeterminate` state. If you're using a controlled checkbox, use the state hook instead. Mark the underlying HTML input checkbox as `indeterminate`. This prop doesn't change icons for you, it just ensures we have the correct `aria-checked` value and the checkbox has indeterminate status.
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"curve" | "round"The shape of the checkbox or radio.
stateNostring | boolean | any[]The state of the control. Typically a boolean, string, or string array.
variantNo"thick" | "fill"The fill, or variant of the checkbox or radio.

useCheckboxState API#

Name RequiredTypeDefault ValueDescription
onChangeNoChangeEventHandler<HTMLInputElement>Your change handlers to run _after_ the default dispatch has occurred.
stateNostring | boolean | any[]falseThe state object of the checkbox. This can be a boolean or an array of items.

useCheckboxState Return#

NameTypeDescription
statestring | boolean | any[]The state object of the checkbox. This can be a boolean or an array of items.
setStateReact.Dispatch<React.SetStateAction<typeof state>>The React dispatch function from useState or a reference to this.setState
onChangeReact.ChangeEventHandler<HTMLInputElement>The change handler to be called by the input control when a change event fires. This calls setState for you