Checkbox
A checkbox, alone or in a group.
MarkdownExamples
Basic
Group
Bind several checkboxes to one array: each adds its value when checked.
Selected: cheese
Indeterminate
Hint and error
Shown under the label and read as its description.
Required to create an account.
API
| Prop | Type | Default |
|---|---|---|
labelText next to the box. The default slot overrides it. | string | — |
disabledDisables the checkbox. | boolean | false |
indeterminateShows the mixed state, e.g. for a "select all" with some rows picked. | boolean | false |
valueWith an array | string | number | — |
hintHelp text under the checkbox, announced as its description. | string | — |
error
| string | boolean | — |
idId for the input; generated with | string | — |
modelValueChecked state, or with an array, the checked | boolean | (string | number)[] | — |
| Event | Payload |
|---|---|
update:modelValue
| [value: boolean | (string | number)[] | undefined] |
| Slot | Props |
|---|---|
defaultLabel content, replacing | — |
indicatorInside | — |
Styling
- Parts
checkboxcheckbox-inputcheckbox-controlcheckbox-labelfield-message- States
data-checkbox-disableddata-checkbox-errordata-field-tone
Keyboard
| Keys | Action |
|---|---|
Space | Toggle |
Accessibility
- It's a native
<input type="checkbox">, so it submits with forms and works with any label.