Skip to content

Error ​

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

vue
<script lang="ts" setup>
import { FormifyForm, FormifyInput, Error, 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" />
		<Error 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