Skip to content

Form ​

The <FormifyForm /> component is the same as the native equivalent with some extra magic under the hood.

This is the root component for every form. The form will extract the data automatically.

Basic usage ​

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

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

</script>
<template>
	<FormifyForm @submit="sendForm">
		<Field name="first_name" />
		<Field name="last_name" />
		<button>Send</button>
	</FormifyForm>
</template>

Api reference ​

Props ​

PropDescription
enctypeSpecifies how the form data should be encoded.
initialValuesInital values for form elements
validation-schemaYou can pass validation schema object from yup/zod/valibot/joi
preservePreserve form data even the Form component is unmounted
nameName of the form.

Events ​

EventDescription
submitSend form data. Data will be automatically extracted.
value-changeEvent when form data changed. Good for side effects.

Methods ​

MethodParameterDescription
resetvoidReset form to default value.
flushvoidForced reset.
setError{ name: string; error: any }Set error messages for specified input.

Slots ​

SlotParameterDescription
default{ values, errors }Gives back the form data and errors.