Hey, devs! π
I'm excited to share a lightweight and powerful form validation solution for your React appsβreact-form-validator-pro
! π
Why You Should Use It:
β
Simple Validation: Just pass in the validation rules, and it automatically handles form field validation.
β
Customizable: Easily add your custom validation rules.
β
Error Handling: Clear error messages, customizable error placement, and it works seamlessly on both change and blur events.
β
Fast Setup: Quick to integrate and use.
Key Features:
- Built-in validations for common fields like email, password, and phone numbers.
- Custom validation functions for any complex logic.
- Supports error messages above or below the form fields.
- Highly customizable styling options to fit your design.
Check out this example usage:
<FormValidator
onSubmit={handleSubmit}
validations={{
email: { required: true, pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, message: 'Invalid email' },
password: { required: true, message: 'Password is required', minLength: 8, },
}}
>
<div>
<label>Email:</label>
<input type="email" name="email" />
</div>
<div>
<label>Password:</label>
<input type="password" name="password" />
</div>
<button type="submit">Submit</button>
</FormValidator>
Install
npm i react-form-validator-pro
NPM
Repository
Github
Repository
No more messy validation logic! This package makes form validation simple and elegant in React.
Follow for more!
Top comments (0)