Checkbox

Basic

It receives the same props as controlled inputs, such as checked and onChange.

useCheckboxState

For convenience, Reakit provides a useCheckboxState that already implements the state logic.

Sizes

Set scales using scale prop like "xs", "sm", "lg" or "xl". The default scale is "base".

Disabled

Disable using disabled prop.

Accessibility

Checkbox uses Reakit Checkbox under the hood, it means it follows WAI-ARIA Checkbox Pattern.

CheckboxGroup follows WAI_ARIA Checkbox Group Pattern.

Read more about accessibility on Reakit.

API

useCheckboxState

See Reakit documentation.

Checkbox

PropertyTypeRequiredDefaultDescription
checkedbooleanfalse-Checkbox's checked state. If present, it's used instead of state.
disabledbooleanfalse-Same as the HTML attribute.
focusablebooleanfalse-When an element is `disabled`, it may still be `focusable`. It works similarly to `readOnly` on form elements. In this case, only `aria-disabled` will be set.
onChangefunctionfalse-Same as the "checkbox" `onChange` prop.
scale
enum
falsebaseControl the size of the component.
Show xstyled properties

Switch also includes a bunch of state properties, see Reakit documentation.

CheckboxGroup

PropertyTypeRequiredDefaultDescription
childrennodefalse-
aria-orientation
enum
false-Specify the orientation of the checkbox group.
Show xstyled properties