Skip to content

mateenagy/vue-formify

Repository files navigation

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, schema validations and a minimal bundle size (~4kb gzipped), making it both secure and efficient.

Features

  • Type Safe: Ensures accurate data types and autocompletion across fields.
  • Validation: Use schema based validators like Zod, Valibot or ArkType.
  • Auto Collect Values: Seamlessly gathers form data.
  • Supports Nested Objects and Arrays: Easily handle complex data structures.
  • Easy Third-Party Integrations: Flexible to work with other libraries.
  • Customizable Components: Easily build and integrate custom components.
  • Lightweight: Small footprint for a faster, more responsive app.

📚 Documentation

Read more in the documentation

📦 Install

npm i vue-formify

💻 Usage

Basic

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

type FormData = {
  email: string;
}

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

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

</script>

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

ArkType example

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

const { Form, Field, handleSubmit } = useForm({
	schema: type({
		first_name: 'string >= 1';
		last_name: 'string >= 1';
	})
});

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

</script>
<template>
	<Form @submit="sendForm">
		<Field name="first_name" />
		<Field name="last_name" />
		<button>Submit</button>
	</Form>
</template>

About

Build powerful, type-safe forms in Vue.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy