{"id":17937770,"url":"https://github.com/michaellasky/react-formguards","last_synced_at":"2025-10-15T22:47:18.142Z","repository":{"id":34906375,"uuid":"188767431","full_name":"michaellasky/react-formguards","owner":"michaellasky","description":"Simple, Declarative Client Side Form Validation","archived":false,"fork":false,"pushed_at":"2023-01-03T22:44:18.000Z","size":6351,"stargazers_count":3,"open_issues_count":25,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T13:07:18.100Z","etag":null,"topics":["declarative","form-validation","javascript","no-dependencies","react","reactjs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaellasky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-27T03:51:38.000Z","updated_at":"2022-08-04T19:23:34.000Z","dependencies_parsed_at":"2023-01-15T10:15:15.938Z","dependency_job_id":null,"html_url":"https://github.com/michaellasky/react-formguards","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellasky%2Freact-formguards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellasky%2Freact-formguards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellasky%2Freact-formguards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaellasky%2Freact-formguards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaellasky","download_url":"https://codeload.github.com/michaellasky/react-formguards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245235849,"owners_count":20582328,"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":["declarative","form-validation","javascript","no-dependencies","react","reactjs"],"created_at":"2024-10-28T23:07:36.350Z","updated_at":"2025-10-15T22:47:13.117Z","avatar_url":"https://github.com/michaellasky.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-formguards\n\u003e Simple, declarative, client side form validation - 2.5kb minzipped\n\n[![NPM](https://img.shields.io/npm/v/react-formguards.svg)](https://www.npmjs.com/package/react-formguards) [![SIZE](https://img.shields.io/bundlephobia/minzip/react-formguards/latest.svg)](https://bundlephobia.com/result?p=react-formguards) [![Build Status](https://travis-ci.com/michaellasky/react-formguards.svg?branch=master)](https://travis-ci.com/michaellasky/react-formguards) [![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) \n\n## The Problem\n\nClient side form validation is a pain in the butt.  Many solutions are complex, cumbersome, or both.  Form validation should be simple.\n\n## The Solution\n\nreact-formguards is powerful and very easy to use.  Simple or complex validation rules can be declaratively defined with only \u0026lt;FormGuard /\u0026gt; tags.  Just add FormGuards and you're done!\n\n## Install\n\n```bash\nnpm install --save react-formguards\n```\n\n## Usage\n\n* Replace your \u0026lt;form /\u0026gt; tag with \u0026lt;ValidatedForm /\u0026gt;, passing an onSubmit callback.  \n  * *onSubmit is only called when all the FormGuard's are satisfied, which means the form is valid*\n\n* Add \u0026lt;FormGuard /\u0026gt; tags anwhere you'd like validation errors to appear.  The FormGuards handle everything else for you.\n\nCheck out the [Live Examples](https://michaellasky.github.io/react-formguards/) to see it in action!\n\nSee the [wiki](https://github.com/michaellasky/react-formguards/wiki) for further documentation.\n\n```jsx\nimport { ValidatedForm, FormGuard, validators } from 'react-formguards'\n\nconst ExampleBasic = () =\u003e {\n\n    return (\n        \u003cValidatedForm onSubmit={(e, formVals) =\u003e console.log(formVals)}\u003e\n            \u003clabel htmlFor='example1-name'\u003eName:\u003c/label\u003e\n            \u003cinput type='text' name='name' id='example1-name' /\u003e\n\n            \u003clabel htmlFor='example1-email'\u003eEmail:\u003c/label\u003e\n            \u003cFormGuard watches='email' validatesWith={validators.required} \u003e\n                Email is required  \n            \u003c/FormGuard\u003e \n            \u003cFormGuard watches='email' validatesWith={validators.email} \u003e\n                Please enter a valid email address  \n            \u003c/FormGuard\u003e \n            \u003cinput type='email' name='email' id='example1-email' /\u003e  \n            \n            \u003clabel htmlFor='example1-phone'\u003eTelephone:\u003c/label\u003e\n            \u003cFormGuard watches='phone' validatesWith={validators.phone} \u003e\n                Please enter a valid phone number  \n            \u003c/FormGuard\u003e \n            \u003cinput type='tel' name='phone' id='example1-phone' /\u003e  \n\n            \u003clabel htmlFor='example1-comments'\u003eComments:\u003c/label\u003e\n            \u003cFormGuard watches='comments' validatesWith={validators.maxLength(80)} \u003e\n                Maximum length (80 characters) exceeded\n            \u003c/FormGuard\u003e \n            \u003ctextarea name='comments' id='example1-comments' /\u003e  \n            \n            \u003cinput type='submit' value='Check the console for onSubmit' /\u003e\n        \u003c/ValidatedForm\u003e\n    );\n}\n\nexport default ExampleBasic;\n```\n\n## License\n\nMIT © [Michael Lasky](https://github.com/NuclearHorseStudios)\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/michaellasky\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/6646599?v=4\" width=\"100px;\" alt=\"Michael Lasky\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMichael Lasky\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#infra-michaellasky\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e \u003ca href=\"https://github.com/michaellasky/react-formguards/commits?author=michaellasky\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"https://github.com/michaellasky/react-formguards/commits?author=michaellasky\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#maintenance-michaellasky\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/michaellasky/react-formguards/commits?author=michaellasky\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaellasky%2Freact-formguards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaellasky%2Freact-formguards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaellasky%2Freact-formguards/lists"}