Checkbox Group
A multi-select group of checkboxes — a native <fieldset> of
<input type="checkbox"> items.
Import
Section titled “Import”<script> import CheckboxGroup from "@invisible-ui/svelte/CheckboxGroup.svelte";</script><script setup> import { CheckboxGroup } from "@invisible-ui/vue";</script>import { CheckboxGroup } from "@invisible-ui/react";<script type="module"> import "@invisible-ui/elements/define";</script>
<ds-checkbox-group></ds-checkbox-group>| Prop | Type | Default | Description |
|---|---|---|---|
items * | CheckboxGroupItem[] | — | |
value | string[] | [] | |
disabled | boolean | false | |
label * | string | — | Accessible name for the group (rendered as the legend). |
name | string | undefined | undefined | Shared form field name; each checked item submits its value under it. |
onValueChange | ((value: string[]) => void) | undefined | undefined | Called whenever the selection changes. |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | CheckboxGroupItem[] | — | |
modelValue | string[] | undefined | v-model value; takes precedence over value when bound. |
value | string[] | () => [] | |
disabled | boolean | false | |
label * | string | — | Accessible name for the group (required; rendered as the legend). |
name | string | undefined | Shared form field name; each checked item submits its value under it. |
onValueChange | (value: string[]) => void | undefined | Called whenever the selected values change. |
| Event | Payload |
|---|---|
update:modelValue | value: string[] |
| Prop | Type | Default | Description |
|---|---|---|---|
items * | CheckboxGroupItem[] | — | |
value | string[] | — | Initial (uncontrolled) or current (controlled) selected values. |
disabled | boolean | false | |
label * | string | — | Accessible name for the group (required; rendered as the legend). |
name | string | — | Shared form field name; each checked item submits its value under it. |
onValueChange | (value: string[]) => void | — | Called whenever the selected values change. |
| Attribute | Reactive | Description |
|---|---|---|
label * | yes | |
value | yes | |
name | yes | |
disabled | yes | |
description | yes | |
error | yes |
Reactive attributes re-render the element when they change after the first render.
Properties: value (string[]), items.
Emits: bubbling change CustomEvent with detail.value (string[]).
Accessibility
Section titled “Accessibility”- A native
<fieldset>/<legend>group of<input type="checkbox">: each item is Tab-focusable and toggled with Space, and several can be checked at once. - Supports per-item and whole-group
disabled(the<fieldset disabled>cascades); the group needs an accessiblelabel.
Example
Section titled “Example”<CheckboxGroup label="Toppings" value={["cheese"]} items={[ { value: "cheese", label: "Cheese" }, { value: "olives", label: "Olives" }, { value: "anchovies", label: "Anchovies", disabled: true }, ]} onValueChange={(v) => (selected = v)}/>In React, value is the list of checked items. onValueChange reports the
whole list after each change:
<CheckboxGroup label="Toppings" name="toppings" value={toppings} items={[ { value: "basil", label: "Basil" }, { value: "olives", label: "Olives" }, ]} onValueChange={setToppings}/>Themeable via --ds-checkbox-*.