mateenagy / vue-formify

Build powerful, type-safe forms in Vue.
https://vue-formify.matenagy.me/
MIT License
41 stars 1 forks source link
form forms type-safe typescript vue vue3

Build powerful, type-safe forms in Vue.

VueFormify is a form-building library for Vue that simplifies creating both simple and complex forms. It offers type safety and a minimal bundle size (~4kb gzipped), making it both secure and efficient.

Features

📚 Documentation

Read more in the documentation

📦 Install

npm i vue-formify

💻 Usage

Basic

<script lang="ts" setup>
import { useForm } from 'vue-formify';

type FormData = {
  username: string;
  password: string;
}

const {
  Form,
  Field,
  Error,
  handleSubmit,
} = useForm<FormData>();

const sendForm = handleSubmit((data) => {
    console.log(data)
})

</script>

<template>
    <Form @submit="sendForm">
        <Field name="email" as="input" />
        <Error error-for="email" />
        <button>Send</button>
    </Form>
</template>