Formulários

VCheckbox

Componentev-model11 exemplos17 propsA2UI · Checkbox

Caixa de verificação para escolhas booleanas e multisseleção, com estados checked, unchecked e indeterminate.

Importação
<script setup lang="ts">
import { VCheckbox } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<script setup lang="ts">

</script>

<template>
  
</template>

Playground

Os controles abaixo são gerados a partir das props declaradas em VCheckbox.types.ts; o código acompanha cada mudança.

Exemplos

Variantes, tamanhos e estados, extraídos das stories da biblioteca.

Default

Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo. Props: label="Product updates", description="Get the latest feature rele…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Product updates',
  modelValue: false,
  description: 'Get the latest feature releases and improvements.'
}
const model = ref(false)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Checked

Variação Marcado. Props: modelValue=true, label="Security alerts", description="Important updates about you…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Security alerts',
  modelValue: true,
  description: 'Important updates about your account security.'
}
const model = ref(true)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Indeterminate

Variação Indeterminado. Props: indeterminate=true, label="Weekly digest", description="A summary of what's new, se…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Weekly digest',
  modelValue: false,
  indeterminate: true,
  description: 'A summary of what's new, sent every Monday.'
}
const model = ref(false)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

With Link

Variação Com link. Props: label="I agree to the", linkLabel="Terms of Service", linkHref="#terms". Slots usados: #terms.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'I agree to the',
  modelValue: false,
  linkLabel: 'Terms of Service',
  linkHref: '#terms'
}
const model = ref(false)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

With Helper

Variação Com texto de apoio. Props: modelValue=true, label="Enable two-factor authentic…", description="Add an extra layer of secur…", helperText="We'll only use this for acc…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Enable two-factor authentication',
  modelValue: true,
  description: 'Add an extra layer of security to your account.',
  helperText: 'We'll only use this for account security.'
}
const model = ref(true)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Error

Variação Erro. Props: label="I agree to the Terms of Ser…", errorMessage="You must accept the terms t…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'I agree to the Terms of Service',
  modelValue: false,
  errorMessage: 'You must accept the terms to continue.'
}
const model = ref(false)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Disabled

Variação Desabilitado. Props: modelValue=true, disabled=true, label="Marketing emails", description="Receive tips, stories and p…".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Marketing emails',
  modelValue: true,
  disabled: true,
  description: 'Receive tips, stories and product news.'
}
const model = ref(true)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Sizes

Variação Tamanhos. Interativo: o estado é mantido na própria story (v-model).

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const sm = ref(true)
const md = ref(true)
const lg = ref(true)
</script>

<template>
  <div style="display:flex;flex-direction:column;gap:12px;max-width:420px">
    <VCheckbox v-model="sm" size="sm" label="Small checkbox" />
    <VCheckbox v-model="md" size="md" label="Medium checkbox" />
    <VCheckbox v-model="lg" size="lg" label="Large checkbox" />
  </div>
</template>

Notification Preferences

Variação Notification Preferences. Interativo: o estado é mantido na própria story (v-model).

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const product = ref(true)
const marketing = ref(false)
const security = ref(true)
const digest = ref(false)
const digestMixed = ref(true)
</script>

<template>
  <div style="display:flex;flex-direction:column;gap:12px;max-width:420px;padding:16px;border:1px solid var(--v-color-border);border-radius:12px;background:var(--v-color-surface)">
    <strong style="font-size:14px">Notification preferences</strong>
    <VCheckbox v-model="product" label="Product updates" description="Get the latest feature releases and improvements." />
    <VCheckbox v-model="marketing" label="Marketing emails" description="Receive tips, stories and product news." />
    <VCheckbox v-model="security" label="Security alerts" description="Important updates about your account security." />
    <VCheckbox v-model="digest" :indeterminate="digestMixed && !digest" label="Weekly digest" description="A summary of what's new, sent every Monday." />
  </div>
</template>

Required

Variação Obrigatório. Props: required=true, label="Aceito os termos".

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Aceito os termos',
  modelValue: false,
  required: true
}
const model = ref(false)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Strike Through Expressive

Variação Strike Through Expressive. Props: motion="expressive", strikeThrough=true, doneOpacity=0.4, label="Tarefa concluída", modelValue=true.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VCheckbox } from 'vueui-nova-kit'

const args = {
  size: 'md',
  label: 'Tarefa concluída',
  modelValue: true,
  motion: 'expressive',
  strikeThrough: true,
  doneOpacity: 0.4
}
const model = ref(true)
</script>

<template>
  <VCheckbox v-bind="args" v-model="model" />
</template>

Acessibilidade

Label associado via <label>, aria-checked="mixed" no indeterminate, Space para alternar, foco visível, área mínima 44×44px, aria-invalid no erro.

Estados

Default · Hover · Focus-visible · Pressed · Checked · Indeterminate · Disabled · Error.

Motion

TriggerPropertyDurationEasing
Check iconopacity/scale100msease-out
Hover backgroundbackground-color100msease-out
Focus ringbox-shadow100msease-out

Respeitar prefers-reduced-motion.

Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.

Props

PropTipoDefaultDescrição
modelValuebooleanfalse—
indeterminatebooleanfalse—
motionVMotionLevelV_MOTION_DEFAULT ("expressive")Micro-interaction intensity. `expressive` enables Spring Check animation.
strikeThroughboolean | VMotionStrike—Strike-through direction when checked (expressive mode).
doneOpacitynumber0.62Label opacity when checked in expressive mode (0–1).
labelstring——
descriptionstring——
helperTextstring——
errorMessagestring——
disabledbooleanfalse—
sizeVCheckboxSize"md"—
namestring——
idstring——
valuestring | number | boolean——
requiredbooleanfalse—
linkHrefstring——
linkLabelstring——

Events

EventoPayloadDescrição
@update:modelValuevalue: boolean—
@changevalue: boolean—

Slots

SlotProps do slot
#label—

Fonte: src/components/form/VCheckbox/VCheckbox.vue · tipos: src/components/form/VCheckbox/VCheckbox.types.ts