npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mvtandas/autoform-vue

v1.0.2

Published

Automatically render forms from your Zod/Yup schema in Vue 3 — the missing Vue integration for AutoForm

Downloads

314

Readme

@autoform/vue

npm version license

Automatically render forms from your Zod schema in Vue 3 — the official Vue integration for AutoForm.

Define your schema once. Get a complete, validated form instantly.

<script setup>
import { AutoForm } from '@autoform/vue'
import '@autoform/vue/style.css'
import { ZodProvider } from '@autoform/zod'
import { z } from 'zod'

const schema = new ZodProvider(
  z.object({
    name: z.string().min(2).describe('Full Name'),
    email: z.string().email(),
    age: z.number().min(18).max(120),
    role: z.enum(['developer', 'designer', 'manager']),
    bio: z.string().optional().describe('Tell us about yourself'),
    newsletter: z.boolean().default(false),
  })
)

function onSubmit(data) {
  console.log('Validated data:', data)
}
</script>

<template>
  <AutoForm :schema="schema" @submit="onSubmit" />
</template>

That's it. No manual field binding. No v-model wiring. No error handling boilerplate.

Features

  • Zero boilerplate — Schema in, form out
  • Zod & Yup support — via @autoform/zod and @autoform/yup
  • Full validation — Automatic error messages from your schema
  • TypeScript — Full type safety with inferred types
  • Customizable — Override any field component or wrapper
  • Tiny — ~2.8 kB gzipped, depends only on @autoform/core
  • Vue 3 — Composition API, reactive state, defineExpose for form control

Installation

pnpm add @autoform/vue @autoform/zod zod
# or
npm install @autoform/vue @autoform/zod zod

Field Type Inference

AutoForm automatically maps Zod types to form fields:

| Zod Type | Rendered As | |----------|-------------| | z.string() | Text input | | z.number() | Number input | | z.boolean() | Checkbox | | z.date() | Date picker | | z.enum([...]) | Select dropdown | | z.object({...}) | Nested fieldset |

Customizing Fields

Override the default field type with fieldConfig:

import { fieldConfig } from '@autoform/zod'

const schema = z.object({
  bio: z.string().superRefine(fieldConfig({
    fieldType: 'textarea',
    inputProps: { placeholder: 'Write something...' },
    label: 'Biography',
    description: 'Max 500 characters',
  })),
})

Custom Field Components

Replace built-in fields with your own:

<template>
  <AutoForm
    :schema="schema"
    :form-components="{
      string: MyCustomInput,
      select: MyCustomSelect,
    }"
    @submit="onSubmit"
  />
</template>

Your custom component receives these props:

interface AutoFormFieldProps {
  field: ParsedField      // Schema field info
  modelValue: any         // Current value
  error?: string          // Validation error
  inputProps?: Record<string, any>  // Extra HTML attributes
}

Accessing Form State

Use template ref to access form internals:

<script setup>
import { ref } from 'vue'

const formRef = ref()

function resetForm() {
  formRef.value?.reset()
}
</script>

<template>
  <AutoForm ref="formRef" :schema="schema" @submit="onSubmit" />
  <button @click="resetForm">Reset</button>
</template>

Exposed: values, errors, isSubmitting, reset()

Using the Composable Directly

For full control, use useAutoForm:

<script setup>
import { useAutoForm } from '@autoform/vue'

const { values, errors, fields, handleSubmit, setFieldValue } = useAutoForm(provider)
</script>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | schema | SchemaProvider | required | Schema provider (ZodProvider, etc.) | | withSubmit | boolean | true | Show submit button | | submitText | string | 'Submit' | Submit button text | | formComponents | Record<string, Component> | — | Custom field components | | uiComponents | AutoFormUIComponents | — | Custom wrapper components | | formProps | Record<string, any> | — | Extra form HTML attributes |

Events

| Event | Payload | Description | |-------|---------|-------------| | @submit | Validated data object | Emitted on successful validation and submit |

Part of the AutoForm Ecosystem

This package is the Vue 3 integration for AutoForm (3,400+ stars). It works alongside:

  • @autoform/core — Schema-agnostic core
  • @autoform/zod — Zod schema adapter
  • @autoform/yup — Yup schema adapter
  • @autoform/react — React integration
  • @autoform/vueVue 3 integration (this package)

License

MIT — Made with ❤️ by Mustafa Vatandas