@vue-formify/valibot
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

VueFormify Valibot schema validator integration

📦 Install

npm i @vue-formify/valibot

💻 Usage

<script lang="ts" setup>
import { schemaFromValibot } from '@vue-formify/valibot';
import { object, string, minLength } from 'valibot'

const schema = schemaFromValibot(
	object({
		first_name: string('Value must be a string', [
			minLength(1, 'Required')
		]),
		last_name: string('Value must be a string', [
			minLength(1, '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>

Package Sidebar

Install

npm i @vue-formify/valibot

Weekly Downloads

1

Version

1.1.4

License

MIT

Unpacked Size

4.28 kB

Total Files

5

Last publish

Collaborators

  • mateenagy