Skip to content

Checkbox

Checkbox input with toggle/switch variant and indeterminate state support. Can be used standalone or within CheckboxGroup.

Import

typescript
import { Checkbox } from 'vuiii'

Basic Usage

vue
<Checkbox v-model="accepted" label="I accept the terms" />

Props

PropTypeDefaultDescription
modelValueany-Checked state (v-model)
requiredbooleanfalseShows a required indicator
disabledbooleanfalseDisables the checkbox
readonlybooleanfalseShows the value, but blocks toggling it
invalidbooleanfalseRenders the validation error state
switchbooleanfalseRenders as a toggle/switch
indeterminatebooleanfalseShows the indeterminate state
labelstring-Label text (alternative to default slot)
descriptionstring-Additional description text below the label
size'small' | 'normal' | 'large''normal'Checkbox size
valueParserValueParser<boolean>-Custom parser to map the checked state to a value

Slots

SlotDescription
defaultLabel content (alternative to label prop)
symbolCustom checkbox/switch symbol. Props: { checked, disabled, indeterminate, invalid, size }

Events

The Checkbox exposes its checked state through v-model (update:modelValue). It emits no other custom events.

Switch Variant

The switch prop restyles the same control as a toggle. It stays a native checkbox underneath, so keyboard behaviour and form semantics are unchanged — pick it when the setting takes effect immediately rather than on submit.

vue
<Checkbox v-model="enabled" switch label="Enable notifications" />

With a Description

vue
<Checkbox v-model="newsletter" label="Subscribe to newsletter" description="Get weekly updates about new features" />

Indeterminate

Use indeterminate for a parent checkbox whose children are partly selected. It is a visual state only — the bound value stays whatever it was, so drive it from your own logic.

vue
<Checkbox
  v-model="allSelected"
  :indeterminate="someSelected && !allSelected"
  label="Select all"
/>

Sizes

vue
<Checkbox v-model="value" size="small" label="Small" />
<Checkbox v-model="value" size="normal" label="Normal" />
<Checkbox v-model="value" size="large" label="Large" />

Required and Disabled

vue
<Checkbox v-model="terms" required label="I agree to the terms" />
<Checkbox :model-value="true" disabled label="Managed by your administrator" />

Multiple Checkboxes

For a list of options driven by data, reach for CheckboxGroup instead of repeating Checkbox by hand — it normalizes the options and emits an array.

Storybook

For interactive examples with all variants, see Checkbox in Storybook.

Released under the MIT License.