WlCheckboxGroup
Appearance
Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions.
Full example
<script setup lang="ts">
const props = { preview: {} as Record<string, unknown> };
import { WlButton, WlCheckboxGroup } from "legato-ui";
import { computed, ref } from "vue";
const selected = ref(["read"]);
const invalid = computed(() => Boolean(props.preview?.invalid ?? (selected.value.length === 0)));
const options = computed(() => [
{ value: "read", label: "Read" },
{ value: "write", label: "Write (unavailable)", disabled: true },
{ value: "share", label: "Share" }
]);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlCheckboxGroup">
<WlCheckboxGroup
v-model="selected"
orientation="horizontal"
:options="options"
option-value="value"
option-disabled="disabled"
legend="Permissions"
:invalid="invalid"
/>
<p v-if="invalid" role="alert">{{ "Select at least one permission." }}</p>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="selected = []">{{ "Clear selection" }}</WlButton>
<WlButton size="sm" @click="selected = ['read']">{{ "Restore example" }}</WlButton>
</div>
<output aria-label="Permissions">{{ selected.join(", ") }}</output>
<p class="wl-text-small">{{ "Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions." }}</p>
</div>
</template>States
Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions.
Full example
<script setup lang="ts">
const props = { preview: {} as Record<string, unknown> };
import { WlButton, WlCheckboxGroup } from "legato-ui";
import { computed, ref } from "vue";
const selected = ref(["read"]);
const invalid = computed(() => Boolean(props.preview?.invalid ?? (selected.value.length === 0)));
const options = computed(() => [
{ value: "read", label: "Read" },
{ value: "write", label: "Write (unavailable)", disabled: true },
{ value: "share", label: "Share" }
]);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlCheckboxGroup">
<WlCheckboxGroup
v-model="selected"
orientation="horizontal"
:options="options"
option-value="value"
option-disabled="disabled"
legend="Permissions"
:invalid="invalid"
/>
<p v-if="invalid" role="alert">{{ "Select at least one permission." }}</p>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="selected = []">{{ "Clear selection" }}</WlButton>
<WlButton size="sm" @click="selected = ['read']">{{ "Restore example" }}</WlButton>
</div>
<output aria-label="Permissions">{{ selected.join(", ") }}</output>
<p class="wl-text-small">{{ "Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions." }}</p>
</div>
</template>Grouped permissions
A labelled group of checkboxes with an array model and application-owned options.
Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions.
Full example
<script setup lang="ts">
import { WlButton, WlCheckboxGroup } from "legato-ui";
import { computed, ref } from "vue";
const selected = ref(["read"]);
const options = computed(() => [
{ value: "read", label: "Read" },
{ value: "write", label: "Write (unavailable)", disabled: true },
{ value: "share", label: "Share" }
]);
</script>
<template>
<div class="wl-stack" data-space="md" data-review-example="WlCheckboxGroup">
<WlCheckboxGroup
v-model="selected"
:options="options"
option-value="value"
option-disabled="disabled"
legend="Permissions"
orientation="horizontal"
:invalid="selected.length === 0"
/>
<p v-if="selected.length === 0" role="alert">{{ "Select at least one permission." }}</p>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="selected = []">{{ "Clear selection" }}</WlButton>
<WlButton size="sm" @click="selected = ['read']">{{ "Restore example" }}</WlButton>
</div>
<output aria-label="Permissions">{{ selected.join(", ") }}</output>
<p class="wl-text-small">{{ "Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions." }}</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model: WlMultiSelectModel<
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
options | readonly TOption[] | [] | Readonly options from which the user can select. |
optionLabel | WlOptionLabel< | Not set | Resolve the visible text of an option. |
optionValue | TResolver | Not set | Resolve the value stored in the selection model. |
optionDisabled | WlOptionDisabled< | Not set | Resolve whether an option is disabled. |
optionKey | WlOptionKeyResolver< | Not set | Resolve stable option identity; provide keys when options may be reordered. |
legend | string | Not set | Visible accessible name for the choice group. |
name | string | Not set | Name used by the component's native form controls. |
orientation | "horizontal" | | "vertical" | Layout direction and applicable arrow-key navigation direction. |
variant | "default" | "default" | Visual treatment within this component family. |
size | WlSizeSm | "md" | Size within the component family's documented scale. |
density | WlDensity | "default" | Spacing density for this component family. |
disabled | boolean | false | Disable user interaction with this component. |
invalid | boolean | false | Expose a validation error state on the control. |
loading | boolean | false | Indicate pending work supplied by the application. |
pt | WlPt< | Not set | Attributes and callbacks for the component's documented pass-through sections. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:modelValue | WlMultiSelectModel< | Emitted when the component requests a model change; the payload is the next value. |
Slots
| Slot | Type / values | Content |
|---|---|---|
legend | legend?(props: Record< | Custom accessible group legend. |
option | option?(props: { option: TOption; index: number; checked: boolean; disabled: boolean }): unknown; | Custom option content with its value and interaction state. |
Pass-through: pt
Sections WlCheckboxGroup are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | fieldset.wl-choice-group | Main element of the component. |
legend | legend.wl-choice-group__legend | Visible name of the entire option group. |
options | div.wl-choice-group__options | Container holding the available controls. |
option | label.wl-checkline | One available option or its control wrapper. |
input | input | Native input that receives focus and control attributes. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Use a legend to name the group and labels for every option.
- A fieldset contains native checkboxes; disabled options stay unchanged.
- Tab visits enabled checkboxes; Space changes one option. Clearing and restoring are application actions.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab / Shift+Tab | Focus an enabled native control. |
| Space | Change the current choice. |
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesChanges are emitted through v-model. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.