Checkbox

View Source

Checkboxes are most commonly used to give users a way to make a range of selections (zero, one, or multiple). They may also be used as a way to have a user indicate that they agree to specific terms and conditions.

Checkbox states

state: unchecked

Checkbox sizes

Custom theme

checkbox: {
fill: 'surface',
stroke: 'grey-6',
focusStroke: 'interaction-dark',
checkedFill: 'interaction',
checkedStroke: 'interaction',
disabled: {
fill: 'grey-2',
stroke: 'grey-4',
checkedFill: 'grey-6',
checkedStroke: 'grey-6',
opacity: 1,
},
}

Props

Accepts StackView props.

checkedboolean

Checks the checkbox, will be overriden if indeterminate is true.

disabledboolean

Disables the checkbox component.

idstring | number

Connects input to its corresponding label’s htmlFor.

If true, puts the checkbox in an indeterminate state.

labelstring | null

Used to label the checkbox. Checkbox must have parent label if left undefined. Pass null to use as a graphical element only, please note you need to provide additional aria attributes when doing so.

namestring

Maps to the internal input’s name prop.

onBlur(event: React.ChangeEvent<HTMLInputElement>) => void

Maps to the internal input’s onBlur prop.

onChange(event: React.ChangeEvent<HTMLInputElement>) => void

Maps to the internal input’s onChange prop.

onFocus(event: React.ChangeEvent<HTMLInputElement>) => void

Maps to the internal input’s onFocus prop.

size'xs' | 'sm' | 'md' | 'lg' | 'xl'

Determines the size of the checkbox.

Maps to the internal input’s value prop.