Skip to Content
Archi-ui 1.0.25 is released 🎉
ComponentsCheckbox

Checkbox

Checkboxs allow the user to select one or more items from a set.

If you have multiple options appearing in a list, you can preserve space by using checkboxes instead of on/off switches. If you have a single option, avoid using a checkbox and use an on/off switch instead.

Basic Checkbox

Usage

import { Checkbox } from 'archi-ui'
<Checkbox />

Default Checked

use the defaultChecked prop to ckeck Checkbox by default.

Size

Use the size prop to change the size of the checkboxs.

Color

Use color prop to apply different colors for component.

Icon

You can modifie the icon for checked using checkedIcon prop.

Indeterminate

A checkbox input can only have two states in a form: checked or unchecked. It either submits its value or doesn’t. Visually, there are three states a checkbox can be in: checked, unchecked, or indeterminate.

You can change the indeterminate icon using the indeterminateIcon prop.

Controlled

You can control the checkbox with the checked and onChange props.

Checkbox is checked: false

Checkbox API

API reference docs for the React Checkbox component.

Props

NameTypeDefaultDescription
checkedbool-If true, the component is checked.
defaultCheckedbool-The default checked state. Use when the component is not Controlled.
classNamestring-Override or extend the styles applied to the component.
size'sm' | 'md' | 'lg''md'The size of the component.
color'primary' | 'secondary' | 'info' | 'warning' | 'success' | 'error''primary'The color of the component.
disabledboolfalseIf true, the component is disabled.
checkedIconnode-The icon to display when the component is checked.
indeterminatefalse-If true, the component appears indeterminate. This does not set the native input element to indeterminate due to inconsistent behaviour across browsers, However, we set a data-indeterminate attribute on the input.
indeterminateIconnode<Minus />The icon to display when the component is indeterminate.
onChangefunc-Callback fired when the state is changed. function(event: React.changeEvent) => void. You can pull out the new checked state by accessing event.target.checked (boolean).
requiredboolfalseIf true, the input element is required.
valueany-The value of the component. The DOM API casts this to a string. the browser uses “on” as the default value.
Last updated on