Gathering detailed insights and metrics for @vee-validate/zod
Gathering detailed insights and metrics for @vee-validate/zod
Gathering detailed insights and metrics for @vee-validate/zod
Gathering detailed insights and metrics for @vee-validate/zod
npm install @vee-validate/zod
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
10,842 Stars
4,828 Commits
1,272 Forks
113 Watching
11 Branches
349 Contributors
Updated on 28 Nov 2024
TypeScript (98.25%)
JavaScript (1.71%)
Shell (0.04%)
Cumulative downloads
Total Downloads
Last day
4.5%
16,159
Compared to previous day
Last week
8.6%
84,482
Compared to previous week
Last month
-3%
348,106
Compared to previous month
Last year
269.1%
2,624,171
Compared to previous year
3
Painless Vue forms
1# Install with yarn 2yarn add vee-validate 3 4# Install with npm 5npm install vee-validate --save
The main v4 version supports Vue 3.x only, for previous versions of Vue, check the following the table
vue Version | vee-validate version | Documentation Link |
---|---|---|
2.x | 2.x or 3.x | v2 or v3 |
3.x | 4.x | v4 |
vee-validate offers two styles to integrate form validation into your Vue.js apps.
The fastest way to create a form and manage its validation, behavior, and values is with the composition API.
Create your form with useForm
and then use defineField
to create your field model and props/attributes and handleSubmit
to use the values and send them to an API.
1<script setup> 2import { useForm } from 'vee-validate'; 3 4// Validation, or use `yup` or `zod` 5function required(value) { 6 return value ? true : 'This field is required'; 7} 8 9// Create the form 10const { defineField, handleSubmit, errors } = useForm({ 11 validationSchema: { 12 field: required, 13 }, 14}); 15 16// Define fields 17const [field, fieldProps] = defineField('field'); 18 19// Submit handler 20const onSubmit = handleSubmit(values => { 21 // Submit to API 22 console.log(values); 23}); 24</script> 25 26<template> 27 <form @submit="onSubmit"> 28 <input v-model="field" v-bind="fieldProps" /> 29 <span>{{ errors.field }}</span> 30 31 <button>Submit</button> 32 </form> 33</template>
You can do so much more than this, for more info check the composition API documentation.
Higher-order components can also be used to build forms. Register the Field
and Form
components and create a simple required
validator:
1<script setup> 2import { Field, Form } from 'vee-validate'; 3 4// Validation, or use `yup` or `zod` 5function required(value) { 6 return value ? true : 'This field is required'; 7} 8 9// Submit handler 10function onSubmit(values) { 11 // Submit to API 12 console.log(values); 13} 14</script> 15 16<template> 17 <Form v-slot="{ errors }" @submit="onSubmit"> 18 <Field name="field" :rules="required" /> 19 20 <span>{{ errors.field }}</span> 21 22 <button>Submit</button> 23 </Form> 24</template>
The Field
component renders an input
of type text
by default but you can control that
Read the documentation and demos.
You are welcome to contribute to this project, but before you do, please make sure you read the contribution guide.
Here we honor past contributors and sponsors who have been a major part on this project.
No vulnerabilities found.
Reason
30 commit(s) and 21 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More