Components

Checkbox

A control that allows the user to toggle between checked and unchecked states.

An accessible checkbox with support for custom checked indicators, labels, descriptions, indeterminate state, and form integration.

Anatomy

  • #indicator: Visual check mark or icon inside the checkbox button.
  • #label: Label text beside the checkbox.
  • #description: Supplementary text below the label.

Usage

Email notificationsReceive updates about your account activity.Marketing emailsGet notified about new features and promotions.All updatesA mix of indeterminate, checked, and unchecked.

Examples

Custom indicator

Use #indicator to render your own checkmark or icon.

<template>
  <Checkbox v-model="checked">
    <template #indicator="{ checked }">
      <svg v-if="checked" class="check-icon" .../>
    </template>
  </Checkbox>
</template>

With description

Use description when the label needs supporting context.

<template>
  <Checkbox
    v-model="enabled"
    label="Enable notifications"
    description="We'll email you when something important happens."
  />
</template>

Indeterminate state

Use "indeterminate" for parent or mixed-selection states.

<script setup lang="ts">
import { ref } from "vue";
const value = ref<boolean | "indeterminate">("indeterminate");
</script>

<template>
  <Checkbox v-model="value">
    <template #indicator="{ checked }">
      <span v-if="checked === 'indeterminate'"></span>
      <span v-else-if="checked"></span>
    </template>
  </Checkbox>
</template>

Custom true/false values

Use custom values when the model should store domain values instead of booleans.

<script setup lang="ts">
const permission = ref<"granted" | "denied">("denied");
</script>

<template>
  <Checkbox
    v-model="permission"
    true-value="granted"
    false-value="denied"
    label="Allow camera access"
  />
</template>

API Reference

Props

PropTypeDefaultDescription
disabledbooleanfalseDisables the checkbox.
idstringautoHTML id for the button element.
namestringHTML name for form submission.
requiredbooleanfalseMarks the field as required.
trueValueunknowntrueModel value when checked.
falseValueunknownfalseModel value when unchecked.
labelstringLabel text. Slot #label takes priority.
descriptionstringDescription text. Slot #description takes priority.
uiCheckboxUiCSS class overrides.

Slots

SlotScoped propsDescription
indicator{ checked }Visual check mark inside the button. checked is true, false, or "indeterminate".
labelLabel text. Defaults to the label prop.
descriptionDescription text. Defaults to the description prop.

Emits

EventPayloadDescription
value-change[value: CheckboxValue, details]Fired when the checked state changes.

UI Options

KeyDescription
wrapperOuter wrapper element.
rootThe interactive button element.
indicatorThe indicator container.
inputHidden native input used for form submission.
textWrapper around label and description.
labelThe label element.
descriptionThe description element.

Styling Hooks

UI keyCSS classData attrs
wrapperakaza-checkbox-wrapper
rootakaza-checkboxdata-akaza-state, data-akaza-disabled
indicatorakaza-checkbox-indicatordata-akaza-state
inputakaza-checkbox-input
textakaza-checkbox-text
labelakaza-checkbox-label
descriptionakaza-checkbox-description