rhf-yup-validator
v1.0.32
Published
This package is created for integration with rhf using functions
Downloads
45
Readme
Title: rhf-yup-validator
Description:
rhf-yup-validator is a library that provides validators compatible with React Hook Form (RHF) using Yup schema validation. It simplifies the process of creating validation schemas for forms in React applications.
Installation 🪛
Install my-project with npm You can install textValidator and its dependencies using npm or yarn:
npm install --save rhf-yup-validator
Importing the Validator⬇️
import { textValidator } from 'rhf-yup-validator'
Creating Validation Schema 🤖
const schema = yup.object().shape({ name: textValidator({ required: true, min: 3, max: 50, label: 'Name' }), // Add other fields to the schema });
Options🙌
The textValidator function accepts the following options:
min: Minimum length of the text (optional).
max: Maximum length of the text (optional).
regex: Regular expression pattern for additional validation (optional).
required: Whether the text is required (default: false).
label: Label used in error messages (default: 'Text').
Support
For support, email [email protected].