Skip to content

Field ​

The <Field /> component is a flexible component. You can render input fields or wrap custom components with it.

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" />
		<button>Send</button>
	</FormifyForm>
</template>

You can also wrap your custom input between Field component:

vue
<template>
    <FormifyForm @submit="sendForm">
        <Field name="first_name" v-slot="{field, error}">
            <label>Firstname</label>
            <input v-bind="field"  />
            <small>{{ error }}</small>
        </Field>
    </FormifyForm>
</template>

Api reference ​

Props ​

PropDescription
nameField name
defaultField default value
ignoreIgnore field when extract data
asRender field as input or select

Slots ​

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