vael-form
Forms
vael-form is a separate, optional package for forms on a schema: Zod, Valibot, ArkType or any Standard Schema library. You keep v-model, and it adds the errors, the accessibility wiring and the submit. It works with vael-ui, with plain inputs and with any other component library.
Install
It needs Vue 3.5 or later, and nothing from vael-ui. Add the schema library you use.
pnpm add vael-form zodOne form
One schema holds the rules. Each input gets three things, all by the field’s name: v-model for the value, attrs for its id, ARIA and blur, and errors for the message.
Why vael-form
- Vue first. Fields are refs, so
v-modelworks on inputs, groups and lists, in VDOM and in Vapor. - Accessible by default.
attrssetsaria-invalidandaria-describedby, and a failed submit focuses the first invalid field. - Errors at the right moment. An error shows once a field is changed and left, not while you pass over it. Autofill and a click on a moving button are handled.
- Translated with your catalog. Schema errors look up keys in your own locale files and follow a locale switch without validating again.
- Small. About 8 KB gzipped. Rules, the message catalog and schema limits load only when a form uses them.
The guide
01Your first formYour first form, its state, and choices such as radios and checkboxes.02When errors showWhen an error appears, per field or for the whole app.03SubmittingSubmitting, server errors, FormData and TanStack Query.04ValidationRules across fields, async checks, and forms without a schema library.05Lists and stepsRows you add and remove, steps, and unions.06Loading and reactingDefaults that load later, fields that follow others, dialogs and stores.07Translating errorsError messages in every language your app speaks.08Nuxt and server renderingThe Nuxt module, server rendering and Vapor.