Skip to content

EzForm

A validator-agnostic, component-agnostic Vue 3 form engine

Why EzForm exists

Most Vue form libraries bundle a validation library, a set of input components, or both. EzForm bundles neither. It is the layer in between: a schema shape, a state engine, and a renderer that dispatches to your components and runs your validators.

<script setup lang="ts">
import { Form } from 'vue-ez-form'
import { z } from 'zod'
import TextInput from './TextInput.vue' // your own component, not EzForm's

const schema = {
  fields: {
    email: {
      type: 'text',
      name: 'email',
      label: 'Email',
      validate: z.string().email('Invalid email address'),
    },
  },
}

const componentMap = { text: TextInput }
</script>

<template>
  <Form :schema="schema" :component-map="componentMap" @submit="(values) => console.log(values)" />
</template>

Head to Getting Started to see this run end to end, or jump straight to the schema shape if you'd rather read the model first.