Skip to content

Checkbox Group

Notifications

A multi-select group of checkboxes — a native <fieldset> of <input type="checkbox"> items.

<script>
import CheckboxGroup from "@invisible-ui/svelte/CheckboxGroup.svelte";
</script>
PropTypeDefaultDescription
items *CheckboxGroupItem[]—
valuestring[][]
disabledbooleanfalse
label *string—Accessible name for the group (rendered as the legend).
namestring | undefinedundefinedShared form field name; each checked item submits its value under it.
onValueChange((value: string[]) => void) | undefinedundefinedCalled whenever the selection changes.
  • 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 accessible label.
<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-*.