Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
React Hook Form | 33,983 | 127 | 1,337 | 4 days ago | 951 | September 23, 2022 | 11 | mit | TypeScript | |
📋 React Hooks for form state management and validation (Web + React Native) | ||||||||||
Redux Form | 12,614 | 11,781 | 1,243 | 24 days ago | 235 | November 17, 2021 | 492 | mit | JavaScript | |
A Higher Order Component using react-redux to keep form state in a Redux store | ||||||||||
Eureka | 11,588 | 490 | 11 days ago | 27 | September 15, 2020 | 170 | mit | Swift | ||
Elegant iOS form builder in Swift | ||||||||||
Vee Validate | 9,634 | 2,190 | 735 | 2 days ago | 282 | September 19, 2022 | 48 | mit | TypeScript | |
✅ Painless Vue forms | ||||||||||
Formily | 9,334 | 119 | 7 days ago | 209 | September 20, 2022 | 11 | mit | TypeScript | ||
📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3 | ||||||||||
Parsley.js | 9,045 | 329 | 41 | 6 months ago | 47 | December 10, 2019 | 69 | mit | JavaScript | |
Validate your forms, frontend, without writing a single line of javascript | ||||||||||
React Final Form | 7,217 | 500 | 384 | 25 days ago | 76 | April 01, 2022 | 385 | mit | JavaScript | |
🏁 High performance subscription-based form state management for React | ||||||||||
Tcomb Form Native | 3,162 | 499 | 18 | 6 months ago | 53 | October 11, 2018 | 128 | mit | JavaScript | |
Forms library for react-native | ||||||||||
Formkit | 2,617 | 13 | 18 hours ago | 144 | September 23, 2022 | 51 | mit | TypeScript | ||
Vue Forms ⚡️ Supercharged | ||||||||||
Formsy React | 2,599 | 2 | 2 years ago | 1 | November 27, 2015 | 149 | mit | JavaScript | ||
A form input builder and validator for React JS |
This project was created by the awesome Bruno Vego - @bvego, and is currently maintained by @ftonato and the community.
A small, simple and fast JS validator. Like, wow thats fast.
Nope's API is heavily inspired stolen from Yup but Nope attempts to be much smaller and much faster. To achieve this Nope only allows for synchronous data validation which should cover most of the use cases.
Instead of throwing errors Nope simply returns the error object and if there are no errors it returns undefined.
For more details on what's available in Nope, check out the documentation.
Typescript definitions included.
To start using Nope simply do
yarn add nope-validator
or
npm install -S nope-validator
or (even), do you wanna to try it online?
// import the dependency on your app
// const Nope = require('nope-validator'); // or
// const { Nope } = require('nope-validator'); // or
import Nope from 'nope-validator';
// create a schema
const UserSchema = Nope.object().shape({
name: Nope.string().atLeast(5, 'Please provide a longer name').atMost(255, 'Name is too long!'),
email: Nope.string().email().required(),
confirmEmail: Nope.string()
.oneOf([Nope.ref('email')])
.required(),
});
UserSchema.validate({
name: 'John',
email: '[email protected]',
confirmEmail: '[email protected]',
}); // returns an error object { name: 'Please provide a longer name '};
UserSchema.validate({
name: 'Jonathan Livingston',
email: '[email protected]',
confirmEmail: '[email protected]',
}); // returns undefined since there are no errors
Huge thanks to the RHF team for making a resolver for nope, enabling you to use nope as a validator in your RHF-controlled forms.
import { nopeResolver } from '@hookform/resolvers/nope';
import { useForm } from 'react-hook-form';
import * as Nope from 'nope-validator';
const schema = Nope.object().shape({
username: Nope.string().required(),
password: Nope.string().required(),
});
function Component({ onSubmit }) {
const {
register,
formState: { errors },
handleSubmit,
} = useForm({
resolver: nopeResolver(schema),
});
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input {...register('username')} />
{errors.username && <div>{errors.username.message}</div>}
<input {...register('password')} />
{errors.password && <div>{errors.password.message}</div>}
<button type="submit">submit</button>
</form>
);
}
Instead of passing it through the validationSchema
prop, you should call Nope's validate on the validate
prop as shown in the example below.
import { Formik } from 'formik';
import * as Nope from 'nope-validator';
const schema = Nope.object().shape({
username: Nope.string().required(),
password: Nope.string().required(),
});
function Component({ onSubmit }) {
return (
<Formik
initialValues={{ username: '', password: '' }}
validate={(values) => schema.validate(values)}
onSubmit={(values) => console.log('Submitted', values)}
>
{() => (
<Form>
<Field type="username" name="username" />
<ErrorMessage name="username" component="div" />
<Field type="password" name="password" />
<ErrorMessage name="password" component="div" />
<button type="submit">Submit</button>
</Form>
)}
</Formik>
);
}
Information describing how to contribute can be found here