Skip to content

<HeadlessField> API

A field component that provides no UI, just the field state and logic.

Props

PropTypeRequiredDescription
nameStringYesField name/path
validateOnStringNoWhen to validate this field ( 'input' | 'change' | 'blur' | 'submit')
validateOnMountBooleanNoWhether to validate when the componet mounts

Slots

SlotPropsDescription
defaultfieldCtrlThe default slot receives the field controller.

Field Controller

The field controller is an object that provides properties and methods for managing the field state and behavior.

Properties

PropertyTypeDescription
idstringThe unique ID of the field.
valueanyThe current value of the field. It is also included in the attrs
errorstringThe error message if the field is invalid. It is the first error message from the array of error messages
attrsobjectHTML attributes for the field.
eventsobjectEvent handlers for the field.
model{ value: any }A reactive object that can be used with v-model for two-way binding. The model property will only trigger validation when the field is dirty.

It is recommend to **NOT use** the `model` as you won't be able to control when the field gets validated. If you do use it, you shouldn't pass the `onChange` and `onInput` events to the input.

Released under the MIT License