VfTextarea
Basic
A textarea input with placeholder text.
<VfTextarea name="bio" placeholder="Tell us about yourself" /><template>
<VfTextarea name="bio" placeholder="Tell us about yourself" />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
bio: {
type: 'textarea',
placeholder: 'Tell us about yourself',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Rows
The rows prop controls the number of visible text rows.
<VfTextarea name="notes" :rows="2" />
<VfTextarea name="essay" :rows="8" /><template>
<VfTextarea name="notes" placeholder="Notes" :rows="2" />
<VfTextarea name="essay" placeholder="Essay" :rows="8" />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
notes: {
type: 'textarea',
placeholder: 'Notes',
rows: 2,
},
essay: {
type: 'textarea',
placeholder: 'Essay',
rows: 8,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Autogrow
The autogrow prop makes the textarea automatically expand its height as content is added or removed. It is true by default. Set it to false to use a fixed height instead.
<VfTextarea name="growing" :autogrow="true" />
<VfTextarea name="fixed" :autogrow="false" /><template>
<VfTextarea name="growing" placeholder="This grows as you type (default)" />
<VfTextarea name="fixed" placeholder="This stays fixed" :autogrow="false" />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
growing: {
type: 'textarea',
placeholder: 'This grows as you type (default)',
},
fixed: {
type: 'textarea',
placeholder: 'This stays fixed',
autogrow: false,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Resize
The resize prop enables the native browser resize handle on the textarea. It is false by default.
<VfTextarea name="feedback" resize /><template>
<VfTextarea name="feedback" placeholder="Drag to resize" resize />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
feedback: {
type: 'textarea',
placeholder: 'Drag to resize',
resize: true,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Icons
The iconBefore and iconAfter props display icons inside the textarea. The icon class format can be configured globally.
<VfTextarea name="message" icon-before="comment" />
<VfTextarea name="notes" icon-after="lock" /><template>
<VfTextarea name="message" placeholder="Write a message..." icon-before="comment" />
<VfTextarea name="notes" placeholder="Internal notes..." icon-after="lock" />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
message: {
type: 'textarea',
placeholder: 'Write a message...',
iconBefore: 'comment',
},
notes: {
type: 'textarea',
placeholder: 'Internal notes...',
iconAfter: 'lock',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Text Addons
The addonBefore and addonAfter props render content alongside the textarea. When passed a string, it displays as a text addon. An array of strings renders multiple addons.
<VfTextarea name="code" addon-before="<>" />
<VfTextarea name="review" addon-after="✎" />
<VfTextarea name="log" :addon-before="['#', 'v1']" addon-after="📋" /><template>
<VfTextarea name="code" placeholder="Enter code..." addon-before="<>" />
<VfTextarea name="review" placeholder="Write a review..." addon-after="✎" />
<VfTextarea name="log" placeholder="Log entry..." :addon-before="['#', 'v1']" addon-after="📋" />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
code: {
type: 'textarea',
placeholder: 'Enter code...',
addonBefore: '<>',
},
review: {
type: 'textarea',
placeholder: 'Write a review...',
addonAfter: '✎',
},
log: {
type: 'textarea',
placeholder: 'Log entry...',
addonBefore: ['#', 'v1'],
addonAfter: '📋',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Element Addons
Addons can also be element schemas, allowing interactive controls like selects, buttons, checkboxes, or radios to be embedded alongside the textarea.
<VfTextarea name="post" :addon-before="{
name: 'format',
type: 'select',
default: 'md',
items: { md: 'Markdown', html: 'HTML', plain: 'Plain' },
}" />
<VfTextarea name="note" :addon-after="{
name: 'submit',
type: 'button',
text: 'Send',
}" />
<VfTextarea name="terms" :addon-before="{
name: 'agree',
type: 'checkbox',
text: 'I agree',
}" />
<VfTextarea name="feedback" :addon-after="[
{ name: 'positive', type: 'radio', text: '👍', radioName: 'sentiment' },
{ name: 'negative', type: 'radio', text: '👎', radioName: 'sentiment' },
]" /><template>
<VfTextarea
name="post"
placeholder="Write your post..."
:addon-before="{
name: 'format',
type: 'select',
default: 'md',
items: { md: 'Markdown', html: 'HTML', plain: 'Plain' },
}"
/>
<VfTextarea
name="note"
placeholder="Add a note..."
:addon-after="{ name: 'submit', type: 'button', text: 'Send' }"
/>
<VfTextarea
name="terms"
placeholder="Terms and conditions..."
:addon-before="{ name: 'agree', type: 'checkbox', text: 'I agree' }"
/>
<VfTextarea
name="feedback"
placeholder="Your feedback..."
:addon-after="[
{ name: 'positive', type: 'radio', text: '👍', radioName: 'sentiment' },
{ name: 'negative', type: 'radio', text: '👎', radioName: 'sentiment' },
]"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
post: {
type: 'textarea',
placeholder: 'Write your post...',
addonBefore: {
name: 'format',
type: 'select',
default: 'md',
items: { md: 'Markdown', html: 'HTML', plain: 'Plain' },
},
},
note: {
type: 'textarea',
placeholder: 'Add a note...',
addonAfter: { name: 'submit', type: 'button', text: 'Send' },
},
terms: {
type: 'textarea',
placeholder: 'Terms and conditions...',
addonBefore: { name: 'agree', type: 'checkbox', text: 'I agree' },
},
feedback: {
type: 'textarea',
placeholder: 'Your feedback...',
addonAfter: [
{ name: 'positive', type: 'radio', text: '👍', radioName: 'sentiment' },
{ name: 'negative', type: 'radio', text: '👎', radioName: 'sentiment' },
],
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Translatable
When the form has multiple languages configured, the textarea can hold per-language values. The default can be provided as a locale-keyed object.
<VfTextarea
name="description"
translate
:languages="{ en: 'English', de: 'German', fr: 'French' }"
/><template>
<VfTextarea
name="description"
translate
:languages="{ en: 'English', de: 'German', fr: 'French' }"
:default="{
en: 'A short description.',
de: 'Eine kurze Beschreibung.',
fr: 'Une courte description.',
}"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
description: {
type: 'textarea',
translate: true,
languages: { en: 'English', de: 'German', fr: 'French' },
default: {
en: 'A short description.',
de: 'Eine kurze Beschreibung.',
fr: 'Une courte description.',
},
},
})
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.
<VfTextarea name="bio" hint="Keep it under 200 characters." /><template>
<VfTextarea
name="bio"
label="Bio"
placeholder="Tell us about yourself"
hint="Keep it under 200 characters."
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
bio: {
type: 'textarea',
label: 'Bio',
placeholder: 'Tell us about yourself',
hint: 'Keep it under 200 characters.',
},
})
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.
<VfTextarea name="notes" help="Markdown formatting is supported." /><template>
<VfTextarea
name="notes"
label="Notes"
placeholder="Add your notes..."
help="Markdown formatting is supported."
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
notes: {
type: 'textarea',
label: 'Notes',
placeholder: 'Add your notes...',
help: 'Markdown formatting is supported.',
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Horizontal Label
The columns prop controls the responsive grid layout. Setting columns.label places the label and input side by side in a horizontal arrangement.
<VfTextarea name="description" label="Description" :columns="{ label: 4 }" /><template>
<VfTextarea
name="description"
label="Description"
placeholder="Enter a description"
:columns="{ label: 4 }"
/>
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
description: {
type: 'textarea',
label: 'Description',
placeholder: 'Enter a description',
columns: { label: 4 },
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Loading
The loading prop displays a loading indicator on the textarea. It also accepts conditions.
<VfTextarea name="content" loading /><template>
<VfTextarea name="content" placeholder="Loading content..." loading />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
content: {
type: 'textarea',
placeholder: 'Loading content...',
loading: true,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Readonly
The readonly prop prevents editing while keeping the textarea focusable and its value visible. It also accepts conditions.
<VfTextarea name="terms" readonly /><template>
<VfTextarea name="terms" default="These terms cannot be modified." readonly />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
terms: {
type: 'textarea',
default: 'These terms cannot be modified.',
readonly: true,
},
})
const [Form] = useForm({ schema })
</script>
<template>
<Form />
</template>Disabled
The disabled prop prevents all interaction. It also accepts conditions.
<VfTextarea name="locked" disabled /><template>
<VfTextarea name="locked" default="Cannot edit" disabled />
</template><script setup lang="ts">
import { defineSchema, useForm } from '@vueform/ui'
const schema = defineSchema({
locked: {
type: 'textarea',
default: 'Cannot edit',
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 | 'textarea' | 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. |
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. |
placeholder | — | The placeholder text displayed when the element is empty. |
addonBefore | — | Content or schema rendered as addons before the input. |
addonAfter | — | Content or schema rendered as addons after the input. |
iconBefore | — | Icon displayed before the input. |
iconAfter | — | Icon displayed after the input. |
loading | — | Whether the element is in loading state. |
columns | — | Responsive grid column sizing for the element's 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 |
|---|---|---|
rows | — | The number of visible text rows for the textarea. |
inputmode | — | The HTML inputmode attribute hinting which virtual keyboard mobile browsers should show. |
autocomplete | — | The HTML autocomplete attribute value for the textarea. When omitted, the element's name is used if it is a valid autofill token (e.g. street-address). |
autogrow | true | Whether the textarea automatically grows to fit its content. When true, the height adjusts as lines are added or removed. |
resize | false | Whether the native browser resize handle is enabled on the textarea. |
string | false | Whether the value is always cast to a string. |
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. |
readonly | false | Whether the input is read-only. |
disabled | false | Whether the element is disabled. |
I18n
| Prop | Default | Description |
|---|---|---|
translate | false | Whether the element's value is translatable into multiple languages. |
language | — | The default selected language. |
languages | — | The available languages for translatable content. |
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. |
untrackOn | — | Controls when the element stops tracking user changes. |
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 textarea. |
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. |
Textarea
| Name | Description |
|---|---|
description | The resolved description text for the element. |
descriptionId | The DOM id for the element's description text region. |
translateAddon | Schema for the language selector addon rendered in translatable mode. |
validation | Per-language validation views keyed by language (default for non-translatable elements). |
currentValidation | The validation view of the active language (default when the element is not translatable). |
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. |
setInputRef() | Registers the underlying input element. Bind it as a function ref in custom templates and slots (:ref="context.setInputRef") — the context members are read-only there, so inputRef can't be assigned directly. Receives the element (or component instance) on mount and null on unmount, like any function ref. |
canonicalDomValue | Whether the registered input's DOM value is the model's own serialization (see MakeInputConfig). Gates both handleInput's event-value pickup and the DOM recovery listeners. |
inputBindings | Spreadable bindings for a native text-like input rendered without v-model: v-bind="context.inputBindings" wires the ref, the user-input report (which also performs the write — the DOM recovery and write-back watchers complete the two-way sync), and the interaction listeners. |
componentBindings | Spreadable bindings for a component input rendered without v-model: v-bind="context.componentBindings" wires modelValue, the update:modelValue handler (write + user-input report), and the interaction listeners for components that emit focus / blur. |
autocomplete | The resolved autocomplete attribute value, or undefined when no prop is given and the element's name is not a valid autofill token. |
autosize() | Adjusts the textarea height to match its scroll height. Temporarily resets height to allow shrinking, then sets it to the content's scroll height. |
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. |
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. |
readonly | Whether the element is readonly, resolved from the prop, form-level setting, or conditional logic. 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. |
loading | Whether the element is in a loading state, true when pending, explicitly set to loading, or resolved via conditions. |
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. |
validateCurrent() | Validates only the active language's value of the element. |
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 |
|---|---|
inputRef | Ref to the underlying input element. |
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. |
placeholder | The resolved placeholder text, supporting static strings and dynamic text props. |
page | Page metadata for stepped/tabbed forms. |
addonable | Whether this element supports before/after addons. |
addonsBefore | Array of resolved before-addons, each an individual AddonItem for VfAddon. |
addonsAfter | Array of resolved after-addons, each an individual AddonItem for VfAddon. |
iconBefore | The resolved CSS class string for the icon displayed before the input. |
iconAfter | The resolved CSS class string for the icon displayed after the input. |
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. |
Internationalization
| Name | Description |
|---|---|
language | The currently active language for translatable elements. |
languages | Resolved map of available languages for translatable elements. |
languageId | Unique DOM id for the language indicator element. |
translatable | Whether the element is in translatable (multilingual) mode. |
Handlers
| Name | Description |
|---|---|
handleInput() | Handles a user-initiated change end to end. Bind it to the one event that means "the user changed it": @input for native text inputs, @change for native checkbox / radio / select / file controls, @update:model-value for components — alongside v-model, or without it.Accepts the new value or the native event carrying it (an event's value is read the way v-model reads it); a plain value may pass the originating event as the second argument so composition filtering still applies. Events fired during an IME composition session are ignored — the composed text arrives once, when the session ends.The value is written to the model only when the model doesn't hold it yet — with v-model in place this is a pure user-input notification, without it handleInput performs the write itself. Values resolved from native events are only picked up while canonicalDomValue is on; on formatted inputs (masks) the event carries display text, so only the notification fires, with the current model value as the payload. Either way it reports the input: fires the input event with (value, event, context$) and triggers validateOn / expression untracking. It does not touch the interaction states — visited and touched come from handleFocus / handleBlur. |
handleKeydown() | Fires the keydown event on the element. |
handleKeyup() | Fires the keyup event on the element. |
handleKeypress() | Fires the keypress event on the element. |
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. |
input | value, e, context$ | Emitted when the input value is changed via the UI by the user. |
keydown | event, context$ | Emitted on keydown, passes the keyboard event and component context. |
keyup | event, context$ | Emitted on keyup, passes the keyboard event and component context. |
keypress | event, context$ | Emitted on keypress, passes the keyboard event and component context. |
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. |
addon-before | addonBefore | Slot that replaces the before-addons section. |
addon-after | addonAfter | Slot that replaces the after-addons section. |
icon-before | iconBefore | Slot that replaces the icon rendered before the input. |
icon-after | iconAfter | Slot that replaces the icon rendered after the input. |
help | help | Slot for customizing the help text. |
language | language languages | Slot that replaces the language selector rendering. |
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-textarea |
labelGroup
The container holding the label and required indicator.
| Element | <div> |
| Classes | .vf-label-group |
label
The label element, associated with the control via for.
| Element | <label> <span> |
| 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 |
addonGroup
The addon group wrapper element.
| Element | <div> |
| Classes | .vf-addon-group |
input
The textarea element.
| Element | <textarea> |
| Classes | .vf-input .vf-textarea-input |
| Bindings | data-invalid data-resizable data-autogrow lang aria-describedby aria-invalid aria-required aria-busy |
addonBefore
An individual addon rendered before the input.
| Element | <VfAddon> |
addonAfter
An individual addon rendered after the input.
| Element | <VfAddon> |
iconBefore
The icon rendered before the input.
| Element | <VfIcon> |
iconAfter
The icon rendered after the input.
| Element | <VfIcon> |
iconGroup
The wrapper element grouping icons and the input.
| Element | <div> |
| Classes | .vf-icon-group |
language
The language selector addon rendered alongside the input.
| Element | <VfAddon> |
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-input-color: var(--vf-gray-800);
--vf-input-color-danger: var(--vf-gray-800);
--vf-input-color-disabled: var(--vf-text-disabled);
--vf-input-ring-color: var(--vf-brand);
--vf-input-ring-color-danger: var(--vf-brand);
--vf-input-ring-offset: -1px;
--vf-input-ring-shadow: none;
--vf-input-ring-shadow-danger: none;
--vf-input-ring-style: solid;
--vf-input-ring-width: 1px;
--vf-input-bg: var(--vf-white);
--vf-input-bg-danger: var(--vf-white);
--vf-input-bg-disabled: var(--vf-bg-disabled);
--vf-input-border-color: var(--vf-gray-300);
--vf-input-border-color-danger: var(--vf-gray-300);
--vf-input-border-color-disabled: var(--vf-border-disabled);
--vf-input-border-style: solid;
--vf-input-border-width-b: var(--vf-border-width-b);
--vf-input-border-width-r: var(--vf-border-width-r);
--vf-input-border-width-t: var(--vf-border-width-t);
--vf-input-radius: var(--vf-radius);
--vf-input-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0);
--vf-input-pb: var(--vf-py);
--vf-input-pl: var(--vf-px);
--vf-input-pr: var(--vf-px);
--vf-input-pt: var(--vf-py);
/**
* 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
* -------------------------------------------------------------------------- */
inputColor: '$gray800',
inputColorDanger: '$gray800',
inputColorDisabled: '$textDisabled',
inputRingColor: '$brand',
inputRingColorDanger: '$brand',
inputRingOffset: '-1px',
inputRingShadow: 'none',
inputRingShadowDanger: 'none',
inputRingStyle: 'solid',
inputRingWidth: '1px',
inputBg: '$white',
inputBgDanger: '$white',
inputBgDisabled: '$bgDisabled',
inputBorderColor: '$gray300',
inputBorderColorDanger: '$gray300',
inputBorderColorDisabled: '$borderDisabled',
inputBorderStyle: 'solid',
inputBorderWidthB: '$borderWidthB',
inputBorderWidthR: '$borderWidthR',
inputBorderWidthT: '$borderWidthT',
inputRadius: '$radius',
inputShadow: '0px 0px 0px 0px rgba(0, 0, 0, 0)',
inputPb: '$py',
inputPl: '$px',
inputPr: '$px',
inputPt: '$py',
/**
* 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\")",
}