Skip to content

Form ​

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

This is the base component for every form. The data will be extracted automatically.

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.
actionIf you set it it will send the data with redirect like the native form
validation-schemaYou can pass validation schema object from yup/zod/valibot/joi
preservePreserve form data even the Form component is unmounted

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.