Components

Checkbox

Source
A checkbox with checked, unchecked, and indeterminate states, plus label and description.
Install with the CLI
npx @vyui/cli add checkbox

Overview

VyCheckbox is a controlled checkbox built on the headless @vyui/core Checkbox primitives. It supports checked, unchecked, and 'indeterminate' states, an optional inline label and description, semantic color, four sizes, and a static highlight ring.

Usage

Bind v-model to a boolean, or set it to 'indeterminate' for the mixed state.

<script setup lang="ts">
import { ref } from 'vue'
import { VyCheckbox } from '@vyui/kit'

const accepted = ref(false)
</script>

<template>
  <VyCheckbox
    v-model="accepted"
    label="I accept the terms"
    description="You can change this later in settings."
  />
</template>

Indeterminate

<VyCheckbox :model-value="'indeterminate'" label="Select all" />

Colors and sizes

<VyCheckbox v-model="a" color="success" size="sm" label="Small" />
<VyCheckbox v-model="b" color="primary" size="md" label="Medium" />
<VyCheckbox v-model="c" color="error" size="lg" label="Large" />

Features and behavior

  • modelValue accepts true, false, or 'indeterminate'; the indeterminate glyph uses indeterminateIcon (default appConfig.ui.icons.minus).
  • The check glyph uses icon (default appConfig.ui.icons.check).
  • label and description render beside the box; the label and description slots override them.
  • highlight paints a static ring in color, independent of focus.
  • disabled dims the control and blocks toggling.

Props

PropTypeDefaultDescription
modelValueboolean | 'indeterminate'falseControlled checked value.
disabledbooleanfalsePrevent toggling and dim the control.
namestringundefinedField name.
valuestringundefinedField value.
colorColor'primary'Checked fill color.
size'sm' | 'md' | 'lg' | 'xl''md'Box and glyph scale.
iconstringappConfig.ui.icons.checkCheck glyph Iconify name.
indeterminateIconstringappConfig.ui.icons.minusIndeterminate glyph Iconify name.
labelstringundefinedLabel text beside the box.
descriptionstringundefinedDescription text below the label.
highlightbooleanfalsePaint a static ring matching color.
idstringundefinedForwarded to the underlying CheckboxRoot.
requiredbooleanundefinedForwarded to the underlying CheckboxRoot.
classanyundefinedClasses merged onto the root.
uiPartial<Record<CheckboxSlot, any>>undefinedPer-instance theme slot overrides.

Color defaults to primary, secondary, success, info, warning, error, or neutral, and supports registry extensions.

Emits

EventPayloadDescription
update:modelValueboolean | 'indeterminate'The checked state changed.

Slots

SlotPropsDescription
labelReplaces the label text.
descriptionReplaces the description text.

Styling and theming

Override globally through appConfig.ui.checkbox or locally with ui.

UI slotPurpose
rootRow layout and gap between box and text.
baseThe box: size, radius, border, and fill.
indicatorWrapper centering the glyph.
iconThe check/indeterminate glyph.
wrapperColumn wrapping label and description.
labelLabel text.
descriptionDescription text.

A checked box paints bg-{color}-500; highlight adds a border-{color}-500 ring. Defaults are primary and md.

Accessibility

State is exposed through the underlying core Checkbox primitives. Always pair the control with a label (or the label slot) so its purpose is announced, and use description for supplementary guidance.