@vue-formify/zod
v1.1.4
Published
Zod schema integration for vue-formify
Downloads
101
Maintainers
Readme
📦 Install
npm i @vue-formify/zod
💻 Usage
<script lang="ts" setup>
import { schemaFromZod } from '@vue-formify/zod';
import { object, string } from 'zod'
const schema = schemaFromZod(
object({
first_name: string().min(1, { message: 'Required' }),
last_name: string().min(1, { message: 'Required' }),
})
)
const sendForm = (data) => {
console.log('data', data);
};
</script>
<template>
<FormifyForm @submit="sendForm" :validation-schema="schema">
<FormifyInput name="first_name" />
<FormifyInput name="last_name" />
<button>Send</button>
</FormifyForm>
</template>