humanonlyweb/ui

Checkbox

A checkbox, alone or in a group.

Markdown

Examples

Basic

Copy code

Group

Bind several checkboxes to one array: each adds its value when checked.

Selected: cheese

Copy code

Indeterminate

Copy code

Hint and error

Shown under the label and read as its description.

Required to create an account.

Copy code

API

PropTypeDefault
label

Text next to the box. The default slot overrides it.

string—
disabled

Disables the checkbox.

booleanfalse
indeterminate

Shows the mixed state, e.g. for a "select all" with some rows picked.

booleanfalse
value

With an array v-model, this value is added/removed when toggled.

string | number—
hint

Help text under the checkbox, announced as its description.

string—
error

true marks it invalid; a string also shows it as the message, replacing the hint.

string | boolean—
id

Id for the input; generated with useId() when omitted.

string—
modelValue

Checked state, or with an array, the checked values.

boolean | (string | number)[]—
EventPayload
update:modelValue

v-model:modelValue update.

[value: boolean | (string | number)[] | undefined]
SlotProps
default

Label content, replacing label.

—
indicator

Inside checkbox-control, e.g. a check icon.

—

Styling

Parts
checkboxcheckbox-inputcheckbox-controlcheckbox-labelfield-message
States
data-checkbox-disableddata-checkbox-errordata-field-tone

Keyboard

KeysAction
SpaceToggle

Accessibility

  • It's a native <input type="checkbox">, so it submits with forms and works with any label.