Installations
npm install vee-validate
Developer Guide
Typescript
Yes
Module System
ESM
Node Version
21.4.0
NPM Version
10.2.4
Score
66
Supply Chain
99.2
Quality
90.7
Maintenance
100
Vulnerability
99.6
License
Releases
Contributors
Languages
TypeScript (98.25%)
JavaScript (1.7%)
Shell (0.04%)
Developer
Download Statistics
Total Downloads
104,348,617
Last Day
32,935
Last Week
414,821
Last Month
2,515,776
Last Year
27,962,658
GitHub Statistics
10,873 Stars
4,832 Commits
1,279 Forks
113 Watching
11 Branches
349 Contributors
Bundle Size
46.43 kB
Minified
13.13 kB
Minified + Gzipped
Package Meta Information
Latest Version
4.15.0
Package Id
vee-validate@4.15.0
Unpacked Size
497.91 kB
Size
101.38 kB
File Count
8
NPM Version
10.2.4
Node Version
21.4.0
Publised On
22 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
104,348,617
Last day
-73.1%
32,935
Compared to previous day
Last week
-32.8%
414,821
Compared to previous week
Last month
-4.8%
2,515,776
Compared to previous month
Last year
24.3%
27,962,658
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Peer Dependencies
1
Painless Vue forms
Features
- 🍞 Easy: Declarative validation that is familiar and easy to setup
- 🧘♀️ Flexible: Synchronous, Asynchronous, field-level or form-level validation
- ⚡️ Fast: Build faster forms faster with intuitive API and small footprint
- 🏏 Minimal: Only handles the complicated form concerns, gives you full control over everything else
- 😎 UI Agnostic: Works with native HTML elements or your favorite UI library components
- 🦾 Progressive: Works whether you use Vue.js as a progressive enhancement or in a complex setup
- ✅ Built-in Rules: Companion lib with 25+ Rules that covers most needs in most web applications
- 🌐 i18n: 45+ locales for built-in rules contributed by developers from all over the world
Getting Started
Installation
1# Install with yarn 2yarn add vee-validate 3 4# Install with npm 5npm install vee-validate --save
Vue version support
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 |
Usage
vee-validate offers two styles to integrate form validation into your Vue.js apps.
Composition API
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.
Declarative Components
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
📚 Documentation
Read the documentation and demos.
Contributing
You are welcome to contribute to this project, but before you do, please make sure you read the contribution guide.
Credits
- Inspired by Laravel's validation syntax
- v4 API Inspired by Formik's
- Nested path types by react-hook-form
- Logo by Baianat
Emeriti
Here we honor past contributors and sponsors who have been a major part on this project.
⚖️ License
No vulnerabilities found.
Reason
30 commit(s) and 19 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 9/30 approved changesets -- score normalized to 3
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 10 are checked with a SAST tool
Reason
17 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-m85w-3h95-hcf9
- Warn: Project is vulnerable to: GHSA-c4pw-33h3-35xw
- Warn: Project is vulnerable to: GHSA-49w6-73cw-chjr
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-f6v4-cf5j-vf3w
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-92r3-m2mg-pj97
- Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
3.4
/10
Last Scanned on 2024-12-16
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