{"id":24751983,"url":"https://github.com/mahmud-r-farhan/react-form-validator-pro","last_synced_at":"2025-10-26T18:37:32.266Z","repository":{"id":274514641,"uuid":"923147806","full_name":"mahmud-r-farhan/react-form-validator-pro","owner":"mahmud-r-farhan","description":"A React form validation package.","archived":false,"fork":false,"pushed_at":"2025-01-27T19:06:23.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T05:55:24.258Z","etag":null,"topics":["forms","javascript","javascript-package","npm","npm-package","npmjs","react","react-form-validator","react-forms","reactjs","validator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-form-validator-pro","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahmud-r-farhan.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-27T18:11:27.000Z","updated_at":"2025-01-27T19:06:26.000Z","dependencies_parsed_at":"2025-01-27T19:49:30.107Z","dependency_job_id":"f58f2564-0e39-4cef-9c3e-832c6d155e32","html_url":"https://github.com/mahmud-r-farhan/react-form-validator-pro","commit_stats":null,"previous_names":["mahmud-r-farhan/react-form-validator-pro"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2Freact-form-validator-pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2Freact-form-validator-pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2Freact-form-validator-pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahmud-r-farhan%2Freact-form-validator-pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahmud-r-farhan","download_url":"https://codeload.github.com/mahmud-r-farhan/react-form-validator-pro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245052652,"owners_count":20553163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forms","javascript","javascript-package","npm","npm-package","npmjs","react","react-form-validator","react-forms","reactjs","validator"],"created_at":"2025-01-28T10:26:25.717Z","updated_at":"2025-10-26T18:37:32.200Z","avatar_url":"https://github.com/mahmud-r-farhan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Form Validator Pro\n\nA lightweight React component for easy form validation and error handling. This package makes building forms with validation a breeze by providing a clean, declarative API.\n\n---\n\n## Features\n- **Easy-to-use**: Quickly add form validation to your React project.\n- **Customizable Rules**: Define required fields, patterns, and error messages.\n- **No Page Reload**: Prevents page reloads on form submission.\n- **Error Handling**: Display custom error messages for invalid fields.\n\n---\n\n## Installation\n\nInstall the package via npm:\n\n```bash\nnpm install react-form-validator-pro\n```\n\n---\n\n## Basic Usage\n\nHere’s how you can use the package in your React project:\n\n### Example\n\n```javascript\nimport React from 'react';\nimport { FormValidator } from 'react-form-validator-pro';\n\nconst App = () =\u003e {\n  const handleSubmit = (formData) =\u003e {\n    console.log('Form submitted:', formData);\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eReact Form Validator Example\u003c/h1\u003e\n      \u003cFormValidator\n        onSubmit={handleSubmit}\n        validations={{\n          username: { required: true, requiredMessage: \"Username is required\" },\n          email: { \n            required: true, \n            pattern: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n            message: 'Invalid email format',\n          },\n          phone: {\n            required: true,\n            type: 'phone',\n            typeMessage: 'Invalid phone number format',\n            minLength: 10,\n            minLengthMessage: 'Phone number must be at least 10 characters long',\n          },\n          password: {\n            required: true,\n            type: 'password',\n            typeMessage: 'Password must contain at least one letter, one number, and one special character',\n            minLength: 8,\n            minLengthMessage: 'Password must be at least 8 characters long',\n          },\n        }}\n        validateOnChange={true}\n        validateOnBlur={true}\n      \u003e\n        \u003cdiv\u003e\n          \u003clabel\u003eUsername:\u003c/label\u003e\n          \u003cinput name=\"username\" placeholder=\"Enter your username\" /\u003e\n        \u003c/div\u003e\n        \u003cdiv\u003e\n          \u003clabel\u003eEmail:\u003c/label\u003e\n          \u003cinput name=\"email\" placeholder=\"Enter your email\" /\u003e\n        \u003c/div\u003e\n        \u003cdiv\u003e\n          \u003clabel\u003ePhone:\u003c/label\u003e\n          \u003cinput name=\"phone\" placeholder=\"Enter your phone number\" /\u003e\n        \u003c/div\u003e\n        \u003cdiv\u003e\n          \u003clabel\u003ePassword:\u003c/label\u003e\n          \u003cinput name=\"password\" type=\"password\" placeholder=\"Enter your password\" /\u003e\n        \u003c/div\u003e\n        \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n      \u003c/FormValidator\u003e\n    \u003c/div\u003e\n  );\n};\n\nexport default App;\n\n```\n\n---\n\n## Props\n\n### **`FormValidator`**\n\n| Prop       | Type     | Default | Description                                                                 |\n|------------|----------|---------|-----------------------------------------------------------------------------|\n| `children` | `node`   | Required| The form fields to validate.                                               |\n| `onSubmit` | `func`   | Required| A callback function that receives the validated form data.                  |\n| `rules`    | `object` | `{}`    | An object defining validation rules for each field.                         |\n\n---\n\n### Rules Format\n\nEach field in the `rules` object should have the following format:\n\n| Key       | Type       | Description                                                |\n|-----------|------------|------------------------------------------------------------|\n| `required`| `boolean`  | If `true`, the field must be filled.                        |\n| `pattern` | `RegExp`   | A regular expression to validate the input against.         |\n| `message` | `string`   | Custom error message to display if the `pattern` check fails.|\n\n---\n\n## Customization\n\nYou can customize error messages by adding them to the `rules` object. For example:\n\n```javascript\n\u003cFormValidator\n  rules={{\n    password: {\n      required: true,\n      pattern: /^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{8,}$/,\n      message: 'Password must be at least 8 characters long and contain letters and numbers',\n    },\n  }}\n\u003e\n```\n\n---\n\n## Development\n\nIf you'd like to contribute:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/mahmud-r-farhan/react-form-validator-pro.git\n   ```\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Run tests:\n   ```bash\n   npm test\n   ```\n4. Build the package:\n   ```bash\n   npm run build\n   ```\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\n## Feedback and Contributions\n\nFeel free to open issues or submit pull requests! Feedback is always appreciated. 😊\n\nMade with ❤️ by Mahmudur Rahman.\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-r-farhan%2Freact-form-validator-pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahmud-r-farhan%2Freact-form-validator-pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahmud-r-farhan%2Freact-form-validator-pro/lists"}