Components

Checkbox Group

Items-based multi-select built on Checkbox.

CheckboxGroup manages an array model for multiple checkbox options. It keeps Akaza's items-based API while using Checkbox for each item, including optional parent checkbox behavior.

Use it when users can choose zero, one, or many values from a known option list.

Anatomy

  • #item: Replaces the whole item row when you need full control.
  • #indicator: Indicator content for child checkboxes.
  • #parent-indicator: Indicator content for the optional select-all parent checkbox.
  • #[option.slot]: Per-option label override when an option has a slot key.

The group, legend, parent row, item rows, and nested checkboxes are generated by the component. Style generated parts with ui.root, ui.item, ui.parentItem, and ui.checkbox.

Usage

Notification channels
Select allToggle every enabled channel.
EmailProduct updates and changelog notes.
SMSCritical security alerts only.
PushIn-app notifications.

Selected: email

Examples

Basic group

Use the items-based API when the option list is known up front.

<script setup lang="ts">
import { ref } from "vue";

const value = ref(["email"]);
const options = [
  { value: "email", label: "Email", description: "Product and security updates." },
  { value: "sms", label: "SMS", description: "Urgent account notices." },
  { value: "push", label: "Push", description: "App notifications." },
];
</script>

<template>
  <CheckboxGroup v-model="value" legend="Notification channels" :options="options" />
</template>

Parent select-all

Use parent to give users one checkbox that controls every enabled item.

<template>
  <CheckboxGroup
    v-model="selected"
    :options="permissions"
    parent
    parent-label="All permissions"
    parent-description="Select every enabled permission."
  />
</template>

Custom label content

Set an option slot name to customize its label while keeping the built-in checkbox behavior.

<script setup lang="ts">
const plans = [
  { value: "starter", label: "Starter" },
  { value: "pro", label: "Pro", slot: "pro" },
];
</script>

<template>
  <CheckboxGroup v-model="selected" :options="plans">
    <template #pro="{ option }">
      <span class="font-medium">{{ option.label }}</span>
      <span class="ml-2 text-xs text-neutral-500">Recommended</span>
    </template>
  </CheckboxGroup>
</template>

Horizontal orientation

Use horizontal orientation for compact filters, sizes, and toolbar-like groups.

<script setup lang="ts">
const sizeOptions = [
  { value: "s", label: "S" },
  { value: "m", label: "M" },
  { value: "l", label: "L" },
  { value: "xl", label: "XL" },
];
</script>

<template>
  <CheckboxGroup
    v-model="sizes"
    :options="sizeOptions"
    orientation="horizontal"
    aria-label="Sizes"
  />
</template>

Required form group

The first enabled checkbox receives the native required constraint until at least one value is selected.

<template>
  <Form>
    <CheckboxGroup
      v-model="channels"
      name="channels"
      legend="Contact methods"
      :options="channelOptions"
      required
    />
    <Button type="submit">Save</Button>
  </Form>
</template>

Cancel a change

Use details.cancel() to block updates that violate your business rule.

<script setup lang="ts">
import type { AkazaChangeEventDetails, CheckboxGroupValue } from "akaza-ui";

function keepOne(value: CheckboxGroupValue[], details: AkazaChangeEventDetails) {
  if (value.length === 0) details.cancel();
}
</script>

<template>
  <CheckboxGroup v-model="selected" :options="options" @value-change="keepOne" />
</template>

API Reference

Props

PropTypeDefaultDescription
optionsCheckboxGroupOption[]Options to render.
valueKeystringProperty used as option value.
labelKeystring"label"Property used as label.
descriptionKeystring"description"Property used as description.
disabledKeystring"disabled"Property used as disabled state.
allValuesCheckboxGroupValue[]option valuesValues controlled by the parent checkbox.
parentbooleanfalseRenders a select-all parent checkbox with indeterminate state.
parentLabelstring"Select all"Parent checkbox label.
parentDescriptionstringParent checkbox description.
disabledbooleanfalseDisables every item.
requiredbooleanfalseRequires at least one checked item for form submission.
orientation"horizontal" | "vertical""vertical"Layout orientation data attribute.
legendstringGroup label used as accessible name fallback.
namestringName used by child checkbox form inputs.
ariaLabelstringAccessible label when no visible legend exists.
ariaLabelledbystringExternal accessible label id.
uiCheckboxGroupUiClasses for root, legend, item, and nested checkbox parts.

CheckboxGroupOption

KeyTypeDescription
labelstringVisible option label.
valuestring | numberSubmitted/model value.
descriptionstringOptional help text passed to the nested checkbox.
disabledbooleanDisables this option.
slotstringNamed slot key for custom item label content.

Emits

EventPayloadDescription
value-change(value, details)Fired before model updates. details.cancel() prevents the update.

Slots

SlotScoped propsDescription
itemoption, value, checked, disabledReplaces the whole item row. You own the rendered control behavior in this slot.
indicatoroption, checkedChild checkbox indicator.
parent-indicatorcheckedParent checkbox indicator.

UI Options

KeyDescription
rootThe group wrapper.
legendThe visible legend element.
parentItemThe parent select-all item wrapper.
itemEach option item wrapper.
checkboxNested Checkbox UI options passed to each checkbox.

State Attributes

CheckboxGroup sets data-akaza-orientation and data-akaza-disabled on the root. Parent and item wrappers set data-akaza-state to checked, unchecked, or indeterminate, plus disabled attributes when disabled.

Styling Hooks

UI keyCSS classData attrs
rootakaza-checkbox-groupdata-akaza-orientation, data-akaza-disabled
legendakaza-checkbox-group-legend
parentItemakaza-checkbox-group-parentdata-akaza-state, data-akaza-disabled
itemakaza-checkbox-group-itemdata-akaza-state, data-akaza-disabled
checkboxnested Checkbox classessee Checkbox