VfCheckboxes
Basic
A checkbox group defined with items as a plain array. Each value is used as both the label and the submitted value.
<VfCheckboxes
name="fruits"
label="Fruits"
:items="['Apple', 'Banana', 'Cherry']"
/><template>
<VfCheckboxes
name="fruits"
label="Fruits"
:items="['Apple', 'Banana', 'Cherry']"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
fruits: {
type: 'checkboxes',
label: 'Fruits',
items: ['Apple', 'Banana', 'Cherry'],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Plain Object
When items is a key-value object, keys become the submitted values and values become the labels.
<VfCheckboxes name="colors" :items="{
red: 'Red',
green: 'Green',
blue: 'Blue',
}" /><template>
<VfCheckboxes
name="colors"
label="Favorite colors"
:items="{ red: 'Red', green: 'Green', blue: 'Blue' }"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
colors: {
type: 'checkboxes',
label: 'Favorite colors',
items: {
red: 'Red',
green: 'Green',
blue: 'Blue',
},
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Object Array
When items is an array of objects, use itemLabel to specify which property holds the display text. Without itemValue, the submitted value is the entire object.
<VfCheckboxes
name="sizes"
item-label="label"
:items="[
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
]"
/><template>
<VfCheckboxes
name="sizes"
label="Sizes"
item-label="label"
:items="[
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
sizes: {
type: 'checkboxes',
label: 'Sizes',
itemLabel: 'label',
items: [
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Use itemValue to extract a specific property as the submitted value instead of the whole object:
<VfCheckboxes
name="sizes"
item-label="label"
item-value="value"
:items="[
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
]"
/><template>
<VfCheckboxes
name="sizes"
label="Sizes"
item-label="label"
item-value="value"
:items="[
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
sizes: {
type: 'checkboxes',
label: 'Sizes',
itemLabel: 'label',
itemValue: 'value',
items: [
{ value: 's', label: 'Small' },
{ value: 'm', label: 'Medium' },
{ value: 'l', label: 'Large' },
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Async Function
The items prop accepts a function that returns a promise. Vueform handles the loading state automatically while the function resolves.
<VfCheckboxes
name="countries"
:items="async () => {
const { data } = await $http.get(
'/data/countries.json'
)
return data
}"
/><script setup lang="ts">
import { useHttp } from '@vueform/ui'
const $http = useHttp()
</script>
<template>
<VfCheckboxes
name="countries"
label="Countries"
item-label="name"
item-value="code"
:items="async () => {
const { data } = await $http.get(
'/data/countries.json'
)
return data
}"
/>
</template><script setup lang="ts">
import { defineSchema, useForm, useHttp } from '@vueform/ui'
const $http = useHttp()
const items = async () => {
const { data } = await $http.get('/data/countries.json')
return data
}
const schema = defineSchema({
countries: {
type: 'checkboxes',
label: 'Countries',
itemLabel: 'name',
itemValue: 'code',
items,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Endpoint
The items prop also accepts a URL string. Vueform sends a request and uses the response as items. Use transformItems to reshape the response if the data isn't at the top level.
<VfCheckboxes name="countries" items="/data/countries.json" /><template>
<VfCheckboxes
name="countries"
label="Countries"
item-label="name"
item-value="code"
items="/data/countries.json"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
countries: {
type: 'checkboxes',
label: 'Countries',
itemLabel: 'name',
itemValue: 'code',
items: '/data/countries.json',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Conditional Items
The itemConditions prop specifies which property on each item object holds conditions that control its visibility. See Conditions on Items for the full syntax.
<VfCheckboxes
name="features"
item-conditions="conditions"
:items="[
{ value: 'basic', label: 'Basic' },
{ value: 'export', label: 'Export' },
{
value: 'analytics',
label: 'Analytics',
conditions: [['premium', '==', true]],
},
]"
/><template>
<VfCheckbox name="premium" text="I have a premium account" />
<VfCheckboxes
name="features"
label="Features"
item-label="label"
item-value="value"
item-conditions="conditions"
:items="[
{ value: 'basic', label: 'Basic' },
{ value: 'export', label: 'Export' },
{
value: 'analytics',
label: 'Analytics',
conditions: [['premium', '==', true]],
},
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
premium: {
type: 'checkbox',
text: 'I have a premium account',
},
features: {
type: 'checkboxes',
label: 'Features',
itemLabel: 'label',
itemValue: 'value',
itemConditions: 'conditions',
items: [
{ value: 'basic', label: 'Basic' },
{ value: 'export', label: 'Export' },
{
value: 'analytics',
label: 'Analytics',
conditions: [['premium', '==', true]],
},
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Disabled Items
The itemDisabled prop specifies which property on each item object determines whether it is disabled.
<VfCheckboxes
name="plans"
item-disabled="disabled"
:items="[
{ value: 'free', label: 'Free' },
{ value: 'pro', label: 'Pro' },
{
value: 'enterprise',
label: 'Enterprise',
disabled: true,
},
]"
/><template>
<VfCheckbox name="premium" text="I have a premium account" />
<VfCheckboxes
name="plans"
label="Plans"
item-label="label"
item-value="value"
item-disabled="disabled"
:items="[
{ value: 'free', label: 'Free' },
{ value: 'pro', label: 'Pro' },
{
value: 'enterprise',
label: 'Enterprise',
disabled: [['premium', '!=', true]],
},
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
premium: {
type: 'checkbox',
text: 'I have a premium account',
},
plans: {
type: 'checkboxes',
label: 'Plans',
itemLabel: 'label',
itemValue: 'value',
itemDisabled: 'disabled',
items: [
{ value: 'free', label: 'Free' },
{ value: 'pro', label: 'Pro' },
{
value: 'enterprise',
label: 'Enterprise',
disabled: [['premium', '!=', true]],
},
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Groups
The groupLabel and groupChildren props enable rendering items in labeled groups. Each group object holds a label and a nested list of items.
<VfCheckboxes
name="permissions"
group-label="category"
group-children="items"
:items="[
{
category: 'Content',
items: [
{ value: 'create', label: 'Create' },
{ value: 'edit', label: 'Edit' },
{ value: 'delete', label: 'Delete' },
],
},
{
category: 'Users',
items: [
{ value: 'invite', label: 'Invite' },
{ value: 'manage', label: 'Manage' },
],
},
]"
/><template>
<VfCheckboxes
name="permissions"
label="Permissions"
item-label="label"
item-value="value"
group-label="category"
group-children="items"
:items="[
{
category: 'Content',
items: [
{ value: 'create', label: 'Create' },
{ value: 'edit', label: 'Edit' },
{ value: 'delete', label: 'Delete' },
],
},
{
category: 'Users',
items: [
{ value: 'invite', label: 'Invite' },
{ value: 'manage', label: 'Manage' },
],
},
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
permissions: {
type: 'checkboxes',
label: 'Permissions',
itemLabel: 'label',
itemValue: 'value',
groupLabel: 'category',
groupChildren: 'items',
items: [
{
category: 'Content',
items: [
{ value: 'create', label: 'Create' },
{ value: 'edit', label: 'Edit' },
{ value: 'delete', label: 'Delete' },
],
},
{
category: 'Users',
items: [
{ value: 'invite', label: 'Invite' },
{ value: 'manage', label: 'Manage' },
],
},
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Conditional Groups
The groupConditions prop specifies which property on each group object holds conditions that control its visibility. Groups whose conditions are not met are hidden entirely. See Conditions on Items for the full syntax.
<VfCheckboxes
name="tools"
group-conditions="conditions"
:items="[
{
category: 'Active',
tools: [
{ value: 'vite', label: 'Vite' },
{ value: 'esbuild', label: 'ESBuild' },
],
},
{
category: 'Archived',
tools: [
{ value: 'gulp', label: 'Gulp' },
{ value: 'grunt', label: 'Grunt' },
],
conditions: [
['showArchived', '==', true],
],
},
]"
/><template>
<VfCheckbox
name="showArchived"
text="Show archived tools"
/>
<VfCheckboxes
name="tools"
label="Build tools"
item-label="label"
item-value="value"
group-label="category"
group-children="tools"
group-conditions="conditions"
:items="[
{
category: 'Active',
tools: [
{ value: 'vite', label: 'Vite' },
{ value: 'esbuild', label: 'ESBuild' },
],
},
{
category: 'Archived',
conditions: [['showArchived', '==', true]],
tools: [
{ value: 'gulp', label: 'Gulp' },
{ value: 'grunt', label: 'Grunt' },
],
},
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
showArchived: {
type: 'checkbox',
text: 'Show archived tools',
},
tools: {
type: 'checkboxes',
label: 'Build tools',
itemLabel: 'label',
itemValue: 'value',
groupLabel: 'category',
groupChildren: 'tools',
groupConditions: 'conditions',
items: [
{
category: 'Active',
tools: [
{ value: 'vite', label: 'Vite' },
{ value: 'esbuild', label: 'ESBuild' },
],
},
{
category: 'Archived',
conditions: [['showArchived', '==', true]],
tools: [
{ value: 'gulp', label: 'Gulp' },
{ value: 'grunt', label: 'Grunt' },
],
},
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Hint Text
The hint prop displays advisory text below the input. Use it to provide contextual guidance to the user.
<VfCheckboxes
name="notifications"
hint="You can change your preferences at any time."
/><template>
<VfCheckboxes
name="notifications"
label="Notifications"
:items="{ email: 'Email', sms: 'SMS', push: 'Push' }"
hint="You can change your preferences at any time."
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
notifications: {
type: 'checkboxes',
label: 'Notifications',
items: { email: 'Email', sms: 'SMS', push: 'Push' },
hint: 'You can change your preferences at any time.',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Help Text
The help prop displays advisory text below the label. Unlike hint (which appears below the input), help is positioned directly under the label.
<VfCheckboxes
name="interests"
help="Select the topics you're interested in."
/><template>
<VfCheckboxes
name="interests"
label="Interests"
:items="{ tech: 'Tech', design: 'Design', business: 'Business' }"
help="Select the topics you're interested in."
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
interests: {
type: 'checkboxes',
label: 'Interests',
items: { tech: 'Tech', design: 'Design', business: 'Business' },
help: "Select the topics you're interested in.",
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Stacked
The stacked prop renders the checkboxes in a horizontal row instead of a vertical list.
<VfCheckboxes
name="options"
:items="{ a: 'Option A', b: 'Option B', c: 'Option C' }"
stacked
/><template>
<VfCheckboxes
name="options"
label="Options"
:items="{ a: 'Option A', b: 'Option B', c: 'Option C' }"
stacked
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
options: {
type: 'checkboxes',
label: 'Options',
items: { a: 'Option A', b: 'Option B', c: 'Option C' },
stacked: true,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Disabled
The disabled prop disables the entire checkbox group. It also accepts conditions.
<VfCheckboxes name="disabled" disabled /><template>
<VfCheckboxes
name="disabled"
label="Disabled"
:items="{ a: 'Option A', b: 'Option B', c: 'Option C' }"
:default="['a']"
disabled
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
disabled: {
type: 'checkboxes',
label: 'Disabled',
items: { a: 'Option A', b: 'Option B', c: 'Option C' },
default: ['a'],
disabled: true,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Props
Configure the component's behavior and appearance with these props.
General
| Prop | Default | Description |
|---|---|---|
name | — | Required. The element's unique identifier and path in the current level of form data model. |
type | 'checkboxes' | The element type identifier. |
id | — | The HTML id attribute for the input element. |
Layout
| Prop | Default | Description |
|---|---|---|
label | — | The label displayed alongside the element. |
hideLabel | false | Whether to visually hide the element's label. |
heading | — | The heading level to render for the container's title. |
page | — | Page configuration for stepped/tabbed forms. Accepts a simple label or a metadata tuple with at least a label property. |
help | — | A help text displayed below the label. |
columns | — | Responsive grid column sizing for the element's layout. |
stacked | false | Whether to render child elements in a stacked (wrapped row) layout. |
layout | true | Custom layout template for this element, false to render the element without any layout wrapper, or true (default) for normal layout. |
spaceTop | — | Adds vertical spacing (padding) above the element. The value maps to a spacing token (1-3): 1 = var(--vf-space-1), .... |
spaceBottom | — | Adds vertical spacing (padding) above the element. The value maps to a spacing token (1-3): 1 = var(--vf-space-1), .... |
lineTop | false | Renders a horizontal line (border) above the element. |
lineBottom | false | Renders a horizontal line (border) below the element. |
Input
| Prop | Default | Description |
|---|---|---|
noExpressions | false | Disables expression resolution for this element. Applies to the element itself only (container elements don't cascade it to their children), and a form-level noExpressions cannot be overridden by setting it to false here. |
description | — | A description text displayed below the element. |
sensitive | false | Whether the element holds sensitive data (passwords, payment details, …). Sensitive values are excluded from locally stored drafts. On a container, the whole subtree is excluded. |
disabled | — | Whether the element is disabled. |
items | — | The option items for the element. |
itemLabel | — | Resolves the label for an item. A string key for property lookup, or a function returning the label string. Not allowed for plain scalar arrays or plain object/record maps. |
itemValue | — | Resolves the value for an item. A string key for property lookup, or a function returning the value. Not allowed for plain scalar arrays or plain object/record maps. Typed as (TItemValueKey & AllowedItemValueKey) | AllowedItemValueKey | ((item) => TItemValueReturn) so:- string keys infer into TItemValueKey through the intersection, which also rejects keys missing from the item shape (the generic itself is only bounded by the simple ItemValueProp, so validation must happen here) - keys remain assignable on the defaulted ElementSchema / FormSchema surface where TItemValueKey is still undefined - mapper return types infer into TItemValueReturn - the item parameter stays concrete and is contextually typed even for bare inline arrows (whose return type cannot drive generics under Vue's single-pass inference — annotate the param or use a named function for full model inference) |
itemDisabled | — | Determines whether an item is disabled. A string key for property lookup, or a function returning a ConditionalProp. Not allowed for plain scalar arrays or plain object/record maps. |
itemConditions | — | Determines whether an item is available. A string key for property lookup, or a function returning a ConditionalProp. Items whose conditions are not met are omitted from the list. Not allowed for plain scalar arrays or plain object/record maps. |
groupLabel | — | Resolves the label for a group. A string key for property lookup on the group object, or a function returning the label string. Not allowed for plain scalar arrays or plain object/record maps. |
groupChildren | — | Resolves the children items for a group. A string key for property lookup on the group object, or a function returning the children in any ItemsProp format. Not allowed for plain scalar arrays or plain object/record maps.The intersection arm infers keys into TGroupChildren while rejecting keys missing from the group shape (the generic itself is only bounded by the simple GroupChildrenProp). The bare AllowedGroupChildren arm keeps keys assignable on the defaulted ElementSchema / FormSchema surface where TGroupChildren is still undefined. |
groupConditions | — | Determines whether a group is available. A string key for property lookup on the group object, or a function returning a ConditionalProp. Groups whose conditions are not met are omitted entirely. Not allowed for plain scalar arrays or plain object/record maps. |
headers | — | Custom HTTP headers to include when loading items from an endpoint. |
method | — | The HTTP method to use when loading items from an endpoint. Defaults to 'GET'. |
itemsTrigger | — | The source that triggers re-resolution of function-based items. Accepts an array of element paths whose values are watched, a Ref, or a function used as a watch getter. When omitted, function-based items are only re-resolved when the items prop reference itself changes. |
itemsDebounce | — | The debounce delay in milliseconds applied before re-resolving function-based items when the itemsTrigger source changes. Defaults to no debounce (immediate re-resolution). |
transformItems | — | Transforms data received from an endpoint into the items format. When items is a string (endpoint URL), the HTTP response data is passed through this function before normalization. |
aligned | false | Whether the element should vertically align with adjacent form controls. |
Data
| Prop | Default | Description |
|---|---|---|
modelValue | — | The current value of the element (v-model). |
default | — | The default/initial value of the element. Being expressionable, a {...} expression string is accepted alongside the model type. |
submit | true | Whether the element value is included in form submission data. |
detached | false | Whether the element is detached from the form's element registry and data model (if applicable). |
transformPayload | — | Transforms the element's value when submitting the form. |
Validation
| Prop | Default | Description |
|---|---|---|
rules | — | Validation rules to apply to the element. |
validateOn | — | Controls when validation is triggered (e.g. on change, blur, or submit). |
debounce | — | Delay in milliseconds before processing input. |
bail | true | Whether to stop validation after the first failing rule. |
ruleMessages | — | Custom error messages keyed by validation rule name. |
displayName | — | The display name used in validation error messages. |
maxErrors | 1 | Maximum number of validation errors to display at once. |
hideErrors | false | Whether to hide validation error messages. |
showRequired | — | Where to show required field indicators (e.g. label, placeholder). |
hoist | false | Whether to push the element's errors to its nearest ancestor element. |
Conditions
| Prop | Default | Description |
|---|---|---|
conditions | — | Conditions that control the element's visibility and availability. |
conditionsTrigger | — | The source that triggers re-evaluation of this element's async conditional props (conditions, disabled, readonly, and validation rule conditions). Accepts an array of element paths whose values are watched, a Ref, or a function used as a watch getter. When omitted, any change in the form model re-triggers evaluation. |
conditionsDebounce | — | The debounce delay in milliseconds applied before re-evaluating this element's async conditional props when the trigger source changes. Overrides the global $conditions.debounce config (default 300). |
Customization
| Prop | Default | Description |
|---|---|---|
parts | — | Custom DOM attribute overrides for the component's structural parts. |
class | — | CSS classes to apply to the component's root element. |
classes | — | Custom CSS class overrides for the component's structural parts. |
reclass | — | CSS class overrides that replace (rather than merge with) default classes. |
tokens | — | Token overrides applied to the element's CSS custom properties. |
slots | — | Custom Vue components to use for named slots. Every component resolves it through the standard outlets pipeline (see useOutlets). |
presets | — | Named configuration presets to apply to the component. |
template | — | A custom Vue component to use as the template instead of the default. |
component | — | A custom Vue component to render in the component's default slot. |
Context
Reactive properties and methods accessible on the component's Context object.
General
| Name | Description |
|---|---|
type | The element's type identifier (e.g. "text", "checkbox", "select"). |
name | The element's name as a string ref. |
props | The resolved component props with defaults applied. |
Checkboxes
| Name | Description |
|---|---|
description | The resolved description text for the element. |
descriptionId | The DOM id for the element's description text region. |
validation | Per-language validation views keyed by language (default for non-translatable elements). |
validator | The validator instance the element is registered with: the form's validator, a store-attached one, or a newly created one. |
shouldValidate | Whether the element should validate live on user input, per the validateOn policy and the form's state. |
onUserInput() | Validates the element on user input when the live-validation policy allows it. |
isFlatContainer | Whether the element's data is flattened into the parent container rather than nested under its own name key. |
containerModel | The model ref the element provides to its children via the container context: the parent's model for flat containers, the element's own model otherwise. |
handleModelUpdate() | Handles a native input event and updates the model from the event target. |
initValidation() | Registers the element with the validator and compiles its rules. |
destroyValidation() | Unregisters the element from the validator and clears its validation views. |
rootModel | The root model backing the form when this element operates as the form root, undefined for every other element. |
sensitivePaths | Data paths holding sensitive data (sensitive: true) within this element's subtree — excluded from locally stored drafts. |
groups | Resolved option groups. Empty when not grouped — use items then. |
rawItems | Library-friendly items for third-party components. Flat lists are the original raw objects (with __disabled injected when conditional disabled resolution is active). Grouped lists are the original group objects with children replaced by the filtered raw items. |
resolvedItems | The raw items data before normalization (from props, endpoint, or function). |
normalizedItems | All normalized items before conditional filtering, flattened across groups when grouped. |
selectedLabel | The resolved label(s) of the currently selected item(s). Returns a single string for single-select, or an array of strings for multi-select. Returns undefined (single) or [] (multiple) when nothing is selected. |
itemLabel | Label accessor to forward to third-party components. Always defined and always string-producing when the itemLabel prop is unset: the synthetic wrapper's label for synthetic items, the normalized-label fallback (JSON for plain objects) otherwise — mirroring what resolveLabel yields on the core-rendered path. |
itemValue | Value accessor to forward to third-party components. Falls back to 'value' for synthetic items. |
itemDisabled | Disabled accessor to forward to third-party components. Points at __disabled when conditional resolution is required. |
grouped | Whether the items are grouped (a groupLabel or groupChildren prop is set). |
resolving | Whether the items are currently being loaded from an endpoint or an async function. |
synthetic | Whether the resolved data uses synthetic { value, label } items. True for plain object maps and arrays of primitives — cases where raw values are wrapped into { value, label } objects. |
resolveItems() | Resolves the items source: fetches endpoint URLs, invokes functions (awaiting async results), and passes plain data through. |
Data
| Name | Description |
|---|---|
model | The element's reactive model value within the form data tree. |
value | The current language-aware value of the element. For translatable elements, returns the value for the active language. |
payload | The element's submission payload. Container elements aggregate from children; leaf elements return their own value. |
nullValue | The value the element holds when it is considered empty. For translatable elements a per-language object is returned. |
initialModel | A snapshot of the model at initialization time, used for dirty checking and reset. |
items | Resolved flat option items. Empty when grouped — use groups then. |
dataPath | The dot-notation path to this element's value within the form data object (e.g. "address.city"). Empty string for the root model. Flat containers inherit their parent's data path. |
tracking | Whether the element's default expression is currently tracked and auto-updating the value. |
update() | Updates the element's model value. Container elements perform a deep merge; leaf elements set the value directly. |
load() | Loads data into the element and fires the load event, cascading to all children. |
reset() | Resets the element to its initial model state and fires the reset event. |
clear() | Clears the element to its null value and fires the clear event. |
track() | Resumes expression tracking after an untrack, immediately re-writing the resolved value. |
untrack() | Stops expression tracking, leaving the current value in place. |
reinit() | Reinitializes the element by rebuilding both its model registration and validation instances. |
State
| Name | Description |
|---|---|
visible | Whether the element is currently visible, based on availability, container visibility, and pager state. |
available | Whether the element is available (not hidden by conditional logic). |
disabled | Whether the element is currently disabled, considering form state, parent container state, local override, and the disabled prop. The prop is evaluated through the conditions pipeline, so sync and async conditional values are supported uniformly. |
focused | Whether the element is currently focused. |
touched | Whether the element has been touched (blurred) by the user. |
visited | Whether the element has been visited (focused) by the user. |
dirty | Whether the current model value differs from the initial model value. |
empty | Whether the element's current value is empty. Container elements check whether all children are empty. |
busy | Whether the element is busy, meaning it is either debouncing or has pending async validation. |
hoisted | Whether this element pushes its errors to its nearest ancestor element instead of displaying and reporting them itself. |
enable() | Programmatically enables the element. |
disable() | Programmatically disables the element. |
Validation
| Name | Description |
|---|---|
invalid | Whether any of the element's validations (across all languages) are currently invalid, including children. |
validated | Whether all of the element's validations (across all languages) have been executed, including children. |
completed | Whether the element is completed, meaning it either has no rules or has been validated without errors. |
success | Whether the element has been validated and passed (always true for elements without own rules), once touched. |
pending | Whether any of the element's validations are currently pending an async check, including children. |
debouncing | Whether any of the element's validations are currently debouncing, including children. |
errors | All error messages for this element: its own plus any pushed up by hoisted children. |
hasError | Whether the element has any active error messages. |
displayErrors | The error messages rendered for this element. Empty when the element pushes its errors to its parent; otherwise errors capped by maxErrors. |
ownErrors | The element's own error messages (validation rules plus custom message bag entries). |
formErrors | Error messages propagated to the form, keyed by element path. Empty when the element pushes its errors to its parent. |
messages | The list of custom messages from the message bag, including messages from hoisted children. |
messageBag | The element's message bag for custom errors and messages. |
required | Whether the element is required by its current validation rules. |
genericName | A human-readable name resolved from displayName, label, floating, placeholder, or the element's name prop. |
validate() | Runs validation on the element's own rules and all children, returning whether everything is valid. |
validateSelf() | Validates the element's own rules (without children), resolving with the result. |
validateChildren() | Validates stateful children, returning whether all are valid. By default only incomplete children run. |
invalidate() | Marks all validation instances as invalidated, requiring revalidation. |
unvalidate() | Resets all validation state, including children's. |
filled() | Checks whether a value is considered filled. |
clean() | Marks the element as clean by updating the initial model snapshot. |
clearErrors() | Clears all error messages from the message bag. |
clearMessages() | Clears all custom messages from the message bag. |
clearMessageBag() | Clears the entire message bag, removing both errors and messages. |
Layout
| Name | Description |
|---|---|
id | The resolved element id, using the id prop or falling back to the auto-generated uid. |
label | The resolved label text for the element. |
help | The resolved help text for the element. |
page | Page metadata for stepped/tabbed forms. |
classes | The resolved CSS class map for the component. |
parts | The resolved DOM attribute overrides for internal elements. |
viewLoaded | Whether the element's view has been loaded (used for lazy rendering optimization). |
$el | Reference to the component's root DOM element. |
resolvedColumns | Resolved column sizes per breakpoint, normalized into container/label/wrapper/group values. |
updateColumns() | Updates the column configuration programmatically. |
scrollTo() | Scrolls the window to this element. If the element belongs to a step or tab, that page is selected first before scrolling. |
focus() | Focuses the first focusable HTML element (input, select, textarea, button, etc.) within the wrapper. Optionally scrolls to the element first. |
Tree
| Name | Description |
|---|---|
form$ | The parent form's context, providing access to form-level state and methods. |
path | The element's dot-notation path in the form tree (e.g. "user.name"). |
componentName | The resolved Vue component name for this element. |
container | The container context providing path, model, and registration methods for child elements. |
children | The child element registry providing registration, unregistration, and reactive child lists. |
Events
| Name | Description |
|---|---|
fire() | Fires an event synchronously, invoking before, main, and after listeners in order. |
fireAsync() | Fires an event asynchronously, awaiting each callback and short-circuiting when any returns false. |
on() | Subscribes a callback to a specific event. |
off() | Removes a previously registered event callback. |
onBefore() | Registers a callback that runs before the main event listeners. |
onAfter() | Registers a callback that runs after the main event listeners. |
Handlers
| Name | Description |
|---|---|
handleBlur() | Fires the blur event on the element. |
handleFocus() | Handles focus by setting the focused state and firing the focus event. |
Accessibility
| Name | Description |
|---|---|
uid | A unique auto-generated identifier for the element. |
helpId | The DOM id for the element's help text region. |
errorId | The DOM id for the element's error message region. |
labelId | The DOM id for the element's label region. |
Events
Events emitted by the component. See Events for details.
| Name | Params | Description |
|---|---|---|
change | newValue, oldValue, context$ | Emitted when the element value changes. |
update:modelValue | value | Emitted to update the v-model binding. |
load | value, context$ | Emitted when the element's value is loaded programmatically via the load method. |
reset | context$ | Emitted when the element is reset to its default value. |
clear | context$ | Emitted when the element's value is cleared. |
invalid | context$ | Emitted when the element becomes invalid. |
valid | context$ | Emitted when the element becomes valid after having been invalid. |
focus | context$ | Emitted when the element receives focus. |
blur | context$ | Emitted when the element loses focus. |
beforeMount | context$ | Emitted before the component is mounted. |
mounted | context$ | Emitted after the component is mounted. |
beforeUnmount | context$ | Emitted before the component is unmounted. |
unmounted | context$ | Emitted after the component is unmounted. |
updated | context$ | Emitted after the component is updated. |
Slots
Named Slots for replacing parts of the component's rendering.
| Name | Scope | Description |
|---|---|---|
template | context | Slot that replaces the entire component rendering. Receives the full component context as a single context prop. |
label | label | Slot for customizing the element's label content. |
required | — | Slot for customizing the required indicator. |
help | help | Slot for customizing the help text. |
default | checkboxName disabled label items groups grouped | Slot that replaces the default checkboxes rendering. |
group | checkboxName disabled label group bindings | Slot that replaces each option group when items are grouped. |
item | checkboxName disabled label item bindings | Slot that replaces each entire VfCheckbox child. |
checkbox | model trueValue falseValue inputName id disabled inputRef text bindings handleBlur handleFocus handleModelUpdate | Slot that replaces each individual checkbox input rendering. Child checkboxes always use the default true / false values; the holder's item value is resolved by name, not passed as trueValue. |
text | text id genericName bindings | Slot that replaces the text/label of each individual checkbox. |
description | description | Slot for customizing the description text. |
errors | errors | Slot for customizing the validation errors display. |
messages | messages | Slot for customizing the info messages display. |
Parts
DOM attribute overrides targeting internal elements. See Parts for details.
panel
The wrapper around root with display: contents when the element is a step or a tab.
| Element | <div> |
| Classes | .vf-panel |
root
The element's root wrapper.
| Element | <div> <fieldset> |
| Classes | .vf-element .vf-space-top-1? .vf-space-top-2? .vf-space-top-3? .vf-space-bottom-1? .vf-space-bottom-2? .vf-space-bottom-3? .vf-line-top? .vf-line-bottom? .vf-checkboxes .vf-choices |
| Bindings | data-align-label |
labelGroup
The container holding the label and required indicator.
| Element | <div> |
| Classes | .vf-label-group |
label
The label element; renders as the corresponding heading when the container's heading prop is set.
| Element | <span> <h1> <h2> <h3> <h4> <h5> <h6> |
| Classes | .vf-label |
| Bindings | id |
required
The required indicator.
| Element | <div> |
| Classes | .vf-required |
elementGroup
The container wrapping the input and related UI.
| Element | <div> |
| Classes | .vf-element-group |
elementWrapper
The wrapper directly around the input control.
| Element | <div> |
| Classes | .vf-element-wrapper |
help
The help text area.
| Element | <div> |
| Classes | .vf-help |
| Bindings | id |
wrapper
The wrapper element containing all checkbox items.
| Element | <div> |
| Classes | .vf-choices-group |
| Bindings | data-stacked data-aligned data-invalid role aria-labelledby aria-label aria-describedby aria-invalid aria-required |
group
The fieldset element wrapping each group when items are grouped.
| Element | <fieldset> |
groupLabel
The legend element displaying the group label.
| Element | <legend> |
item
Props factory for each VfCheckbox child component, receiving the item data.
| Element | <VfCheckbox> |
description
The description text area.
| Element | <div> |
| Classes | .vf-description |
| Bindings | id |
errors
The validation errors container.
| Element | <div> |
| Classes | .vf-errors |
| Bindings | id role |
error
An individual validation error.
| Element | <div> |
| Classes | .vf-error |
messages
The info messages container.
| Element | <div> |
| Classes | .vf-messages |
message
An individual info message.
| Element | <div> |
| Classes | .vf-message |
Tokens
All the CSS variables that control this component's appearance with default values in the default theme. See Theming Guide for details.
:root {
/**
* Element tokens
* -------------------------------------------------------------------------- */
--vf-choice-aligned-margin: calc((1lh - (var(--vf-choice-height) + var(--vf-choice-border-width-t))) / 2 + var(--vf-input-pt)) 0 0 0;
--vf-choices-direction: column;
--vf-choices-gutter-x: 0.75rem;
--vf-choices-gutter-y: 0.25rem;
/**
* Shared element layout tokens
* -------------------------------------------------------------------------- */
--vf-element-line-color: var(--vf-gray-300);
--vf-label-font-size: 1rem;
--vf-label-font-weight: 600;
--vf-label-group-h-padding: calc(var(--vf-py) + var(--vf-border-width-t)) 0 0 0;
--vf-label-group-v-padding: 0 0 0.375rem 0;
--vf-required-bg: transparent;
--vf-required-color: inherit;
--vf-required-content: '*';
--vf-required-h: auto;
--vf-required-icon: none;
--vf-required-w: auto;
--vf-help-bg: transparent;
--vf-help-border-color: transparent;
--vf-help-border-style: solid;
--vf-help-border-width: 0;
--vf-help-color: var(--vf-text-soft);
--vf-help-font-size: 0.875rem;
--vf-help-padding: 0;
--vf-help-radius: var(--vf-radius);
--vf-description-bg: transparent;
--vf-description-border-color: transparent;
--vf-description-border-style: solid;
--vf-description-border-width: 0;
--vf-description-color: var(--vf-text-soft);
--vf-description-font-size: 0.875rem;
--vf-description-padding: 0;
--vf-description-radius: var(--vf-radius);
--vf-errors-bg: transparent;
--vf-errors-border-color: transparent;
--vf-errors-border-style: solid;
--vf-errors-border-width: 0;
--vf-errors-color: var(--vf-red);
--vf-errors-font-size: 0.875rem;
--vf-errors-padding: 0;
--vf-errors-radius: var(--vf-radius);
--vf-messages-bg: transparent;
--vf-messages-border-color: var(--vf-border-success);
--vf-messages-border-style: solid;
--vf-messages-border-width: 0;
--vf-messages-color: var(--vf-green);
--vf-messages-font-size: 0.875rem;
--vf-messages-padding: 0;
--vf-messages-radius: var(--vf-radius);
--vf-input-border-width-l: var(--vf-border-width-l);
--vf-icon-font-size: 0.875rem;
--vf-icon-group-color: inherit;
--vf-icon-group-color-danger: var(--vf-color-danger);
--vf-icon-group-width: 2.5rem;
--vf-element-group-gutter-x: 0;
--vf-element-group-gutter-y: 0.25rem;
--vf-element-wrapper-padding: 0;
/**
* Semantic tokens
* -------------------------------------------------------------------------- */
--vf-icon-height: 0.75rem;
--vf-icon-width: 0.75rem;
/**
* Primitives tokens
* -------------------------------------------------------------------------- */
--vf-space-1: 1rem;
--vf-space-2: 2rem;
--vf-space-3: 3rem;
--vf-icon-loading: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='currentColor' stroke-width='1.5' stroke-dasharray='30.6 10.2' stroke-linecap='round'/%3E%3C/svg%3E");
}{
/**
* Element tokens
* -------------------------------------------------------------------------- */
choiceAlignedMargin: 'calc((1lh - ($choiceHeight + $choiceBorderWidthT)) / 2 + $inputPt) 0 0 0',
choicesDirection: 'column',
choicesGutterX: '0.75rem',
choicesGutterY: '0.25rem',
/**
* Shared element layout tokens
* -------------------------------------------------------------------------- */
elementLineColor: '$gray300',
labelFontSize: '1rem',
labelFontWeight: '600',
labelGroupHPadding: 'calc($py + $borderWidthT) 0 0 0',
labelGroupVPadding: '0 0 0.375rem 0',
requiredBg: 'transparent',
requiredColor: 'inherit',
requiredContent: "'*'",
requiredH: 'auto',
requiredIcon: 'none',
requiredW: 'auto',
helpBg: 'transparent',
helpBorderColor: 'transparent',
helpBorderStyle: 'solid',
helpBorderWidth: '0',
helpColor: '$textSoft',
helpFontSize: '0.875rem',
helpPadding: '0',
helpRadius: '$radius',
descriptionBg: 'transparent',
descriptionBorderColor: 'transparent',
descriptionBorderStyle: 'solid',
descriptionBorderWidth: '0',
descriptionColor: '$textSoft',
descriptionFontSize: '0.875rem',
descriptionPadding: '0',
descriptionRadius: '$radius',
errorsBg: 'transparent',
errorsBorderColor: 'transparent',
errorsBorderStyle: 'solid',
errorsBorderWidth: '0',
errorsColor: '$red',
errorsFontSize: '0.875rem',
errorsPadding: '0',
errorsRadius: '$radius',
messagesBg: 'transparent',
messagesBorderColor: '$borderSuccess',
messagesBorderStyle: 'solid',
messagesBorderWidth: '0',
messagesColor: '$green',
messagesFontSize: '0.875rem',
messagesPadding: '0',
messagesRadius: '$radius',
inputBorderWidthL: '$borderWidthL',
iconFontSize: '0.875rem',
iconGroupColor: 'inherit',
iconGroupColorDanger: '$colorDanger',
iconGroupWidth: '2.5rem',
elementGroupGutterX: '0',
elementGroupGutterY: '0.25rem',
elementWrapperPadding: '0',
/**
* Semantic tokens
* -------------------------------------------------------------------------- */
iconHeight: '0.75rem',
iconWidth: '0.75rem',
/**
* Primitives tokens
* -------------------------------------------------------------------------- */
space1: '1rem',
space2: '2rem',
space3: '3rem',
iconLoading: "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='currentColor' stroke-width='1.5' stroke-dasharray='30.6 10.2' stroke-linecap='round'/%3E%3C/svg%3E\")",
}