Skip to content

Checkbox

Checkbox allows users to toggle between two states. Supports standalone use, grouped mode, and more.

Basic Usage

Two-way binding via v-model.

Show Code
vue
<TCheckbox label="Default checkbox"/>
<TCheckbox v-model="agreed" label="Checked"/>
<TCheckbox label="Disabled" disabled/>
<TCheckbox label="Disabled (checked)" disabled model-value="true"/>

Inline Layout

Use the inline prop to arrange checkboxes horizontally.

Show Code
vue
<TCheckbox inline label="Option A"/>
<TCheckbox inline label="Option B"/>

Wrap multiple TCheckbox components inside TCheckboxGroup. The v-model automatically manages the array of selected values. Props like name, inline, disabled, and validation can be set once on the group and applied to all children.

Show Code
vue
<TCheckboxGroup v-model="checkedArr">
  <TCheckbox value="apple" label="Apple" />
  <TCheckbox value="banana" label="Banana" />
  <TCheckbox value="orange" label="Orange" />
</TCheckboxGroup>

options Mode (Array Generation)

Pass a string array or object array via the options prop to auto-generate TCheckbox components — no need to write child components manually.

String array: each string serves as both label and value.
Object array: you can specify label, value, and disabled.
Custom rendering: use the #option slot to customize each option's label content.

Show Code
vue
<!-- String array -->
<TCheckboxGroup v-model="checkedArr" :options="['Apple', 'Pear', 'Orange']" />

<!-- Object array -->
<TCheckboxGroup v-model="checkedArr" :options="[
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana' },
  { label: 'Orange', value: 'orange' },
]" />

<!-- With disabled options -->
<TCheckboxGroup v-model="checkedArr" disabled :options="[
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana', disabled: true },
]" />

Indeterminate State

Use the indeterminate prop to show a mixed (half-checked) state. Typical scenario: tree views or select-all/deselect-all lists where some (but not all) child items are checked.

Note: indeterminate is a visual-only state — it does not affect the v-model value.

Show Code
vue
<TCheckbox indeterminate label="Indeterminate state"/>

Validation States

Use the validation prop to set validation state. Pair with .valid-feedback / .invalid-feedback for messages.

Show Code
vue
<TCheckbox label="Valid state" validation="valid"/>
<div class="valid-feedback">Looks good!</div>

<TCheckbox label="Invalid state" validation="invalid"/>
<div class="invalid-feedback">Please check this option.</div>

Custom Label (Slot)

Use the default slot to customize the label content — supports rich text and icons.

Show Code
vue
<TCheckbox>
  <span>I agree to the <span class="text-danger">Terms of Service</span></span>
</TCheckbox>

API

TCheckbox Props

PropDescriptionTypeDefault
v-modelBinding value (standalone: boolean, group mode: auto-managed)booleanfalse
valueOption identifier in group modeanyundefined
labelLabel textstringundefined
inlineInline layoutbooleanfalse
disabledDisabled statebooleanfalse
indeterminateIndeterminate (visual only)booleanfalse
validationValidation state'valid' | 'invalid'undefined
idNative id attributestringundefined
nameNative name attributestringundefined
requiredWhether requiredbooleanfalse

TCheckbox Emits

EventDescriptionCallback
update:modelValueTriggered on value change (standalone mode)(value: boolean) => void

TCheckboxGroup Props

PropDescriptionTypeDefault
v-modelArray of selected valuesany[][]
optionsOption array (string or object), auto-generates TCheckbox children(string | { label: string, value?: any, disabled?: boolean })[]undefined
nameGroup name (auto-applied to child TCheckbox)stringundefined
inlineInline layout (auto-applied to children)booleanfalse
disabledDisable all childrenbooleanfalse
validationValidation state (auto-applied to children)'valid' | 'invalid'undefined

TCheckboxGroup Emits

EventDescriptionCallback
update:modelValueTriggered when selected values change(value: any[]) => void
changeTriggered when selected values change(value: any[]) => void

TCheckbox Slots

SlotDescription
defaultCustom label content (replaces label prop)

TCheckboxGroup Slots

SlotDescriptionScope
defaultCustom child items (when options is not set)
optionCustom option label (when options is set){ option: { label, value, disabled }, checked: boolean }