Skip to content

FormifyError

The <FormifyError /> component is for show error message for defined input field.

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

const form = ref<FormType>();

const sendForm = (data) => {
    if (!data.email.length) {
        form.value?.setError('email', 'Email required!');
    }
};

</script>
<template>
	<FormifyForm @submit="sendForm">
		<FormifyInput name="email" />
		<FormifyError error-for="email" />
		<button>Send</button>
	</FormifyForm>
</template>

Api reference

Props

PropDescription
error-for (required)The name of the input to show the error for

Slots

SlotParameterDescription
error{ error: string }Customize error