Formulários
VCheckbox
Caixa de verificação para escolhas booleanas e multisseleção, com estados checked, unchecked e indeterminate.
<script setup lang="ts">
import { VCheckbox } from 'vueui-nova-kit'
</script>Uso
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
<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
| Trigger | Property | Duration | Easing |
|---|---|---|---|
| Check icon | opacity/scale | 100ms | ease-out |
| Hover background | background-color | 100ms | ease-out |
| Focus ring | box-shadow | 100ms | ease-out |
Respeitar prefers-reduced-motion.
Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.
Props
| Prop | Tipo | Default | Descrição |
|---|---|---|---|
modelValue | boolean | false | — |
indeterminate | boolean | false | — |
motion | VMotionLevel | V_MOTION_DEFAULT ("expressive") | Micro-interaction intensity. `expressive` enables Spring Check animation. |
strikeThrough | boolean | VMotionStrike | — | Strike-through direction when checked (expressive mode). |
doneOpacity | number | 0.62 | Label opacity when checked in expressive mode (0–1). |
label | string | — | — |
description | string | — | — |
helperText | string | — | — |
errorMessage | string | — | — |
disabled | boolean | false | — |
size | VCheckboxSize | "md" | — |
name | string | — | — |
id | string | — | — |
value | string | number | boolean | — | — |
required | boolean | false | — |
linkHref | string | — | — |
linkLabel | string | — | — |
Events
| Evento | Payload | Descrição |
|---|---|---|
@update:modelValue | value: boolean | — |
@change | value: boolean | — |
Slots
| Slot | Props do slot |
|---|---|
#label | — |
Fonte: src/components/form/VCheckbox/VCheckbox.vue · tipos: src/components/form/VCheckbox/VCheckbox.types.ts