{"id":27950846,"url":"https://github.com/obss/react-validatable-form","last_synced_at":"2025-05-07T16:16:01.770Z","repository":{"id":41987307,"uuid":"415091243","full_name":"obss/react-validatable-form","owner":"obss","description":"React validatable form hook that is used to create dynamic client side validations on react forms","archived":false,"fork":false,"pushed_at":"2025-02-07T14:32:06.000Z","size":19807,"stargazers_count":23,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T16:15:54.787Z","etag":null,"topics":["hooks","react","validation","validation-library","validator"],"latest_commit_sha":null,"homepage":"https://obss.github.io/react-validatable-form-demo/","language":"CSS","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/obss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-10-08T18:35:05.000Z","updated_at":"2025-03-17T16:54:21.000Z","dependencies_parsed_at":"2024-06-19T04:10:57.189Z","dependency_job_id":null,"html_url":"https://github.com/obss/react-validatable-form","commit_stats":{"total_commits":71,"total_committers":5,"mean_commits":14.2,"dds":"0.12676056338028174","last_synced_commit":"67dd40732f089495c0802b38fa88b6967ce5dc89"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obss%2Freact-validatable-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obss%2Freact-validatable-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obss%2Freact-validatable-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obss%2Freact-validatable-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obss","download_url":"https://codeload.github.com/obss/react-validatable-form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912949,"owners_count":21824066,"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":["hooks","react","validation","validation-library","validator"],"created_at":"2025-05-07T16:16:01.087Z","updated_at":"2025-05-07T16:16:01.758Z","avatar_url":"https://github.com/obss.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Validatable Form \u003c!-- omit in toc --\u003e\n\n\u003e React validatable form hook that is used to create dynamic client side validations on React forms.\n\n\u003cimg alt=\"examplegif\" src=\"https://raw.githubusercontent.com/obss/react-validatable-form/master/public/example_video.gif\" /\u003e\n\n---\n\n[![NPM (scoped)](https://img.shields.io/npm/v/react-validatable-form?label=npm%20%7C%20web)](https://www.npmjs.com/package/react-validatable-form)\n[![License](https://img.shields.io/github/license/obss/react-validatable-form.svg)](https://github.com/obss/react-validatable-form/blob/master/LICENSE)\n[![GitHub contributors](https://img.shields.io/github/contributors/obss/react-validatable-form)](https://github.com/obss/react-validatable-form/graphs/contributors)\n[![Github Issues](https://img.shields.io/github/issues/obss/react-validatable-form.svg)](https://github.com/obss/react-validatable-form/issues)\n[![Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/obss/react-validatable-form)](https://github.com/obss/react-validatable-form)\n[![Downloads](https://img.shields.io/npm/dw/react-validatable-form.svg)](https://www.npmjs.com/package/react-validatable-form)\n[![Bundle Size](https://img.shields.io/bundlephobia/min/react-validatable-form)](https://www.npmjs.com/package/react-validatable-form)\n\n---\n\n## Table of Contents \u003c!-- omit in toc --\u003e\n\n-   [Installation](#installation)\n\n-   [Getting Started](#getting-started)\n\n    -   [Setup ReactValidatableFormProvider](#setup-reactvalidatableformprovider)\n    -   [useValidatableForm Hook Usage](#usevalidatableform-hook-usage)\n\n-   [Examples](#examples)\n\n-   [Contributing](#contributing)\n\n-   [License](#license)\n\n---\n\n## Installation\n\n**react-validatable-form** requires:\n\n-   React **17.0.2** or later\n\n```shell\n\nyarn add react-validatable-form\n\n```\n\nor\n\n```shell\n\nnpm install react-validatable-form\n\n```\n\n## Getting Started\n\n### Setup ReactValidatableFormProvider\n\nWrap your App inside `ReactValidatableFormProvider`.\n\n```js\nimport { ReactValidatableFormProvider } from 'react-validatable-form';\n\n// Wrap your app inside ReactValidatableFormProvider\nconst App = () =\u003e {\n    return (\n        \u003cReactValidatableFormProvider\n            lang={'en'}\n            customRules={null}\n            translations={null}\n            hideBeforeSubmit={true}\n            showAfterBlur={true}\n            focusToErrorAfterSubmit={true}\n            elementFocusHandler={null}\n        \u003e\n            \u003cMain /\u003e\n        \u003c/ReactValidatableFormProvider\u003e\n    );\n};\n```\n\n### useValidatableForm Hook Usage\n\n```js\nimport { useValidatableForm } from 'react-validatable-form';\n\nconst initialFormData = {};\nconst rules = [{ path: 'val', ruleSet: [{ rule: 'required' }] }];\n\nconst MyComponent = () =\u003e {\n    const { isValid, formData, setPathValue, setFormIsSubmitted, setPathIsBlurred, getValue, getError } =\n        useValidatableForm({\n            rules,\n            initialFormData,\n        });\n\n    return (\n        \u003c\u003e\n            \u003cinput\n                type=\"text\"\n                value={getValue('val') || ''}\n                onChange={(e) =\u003e setPathValue('val', e.target.value)}\n                onBlur={() =\u003e setPathIsBlurred('val')}\n                id=\"val\"\n            /\u003e\n            \u003cdiv className=\"errorText\"\u003e{getError('val') || ' '}\u003c/div\u003e\n            \u003cdiv\u003e\n                \u003cbutton onClick={() =\u003e setFormIsSubmitted()}\u003eSubmit Form\u003c/button\u003e\n            \u003c/div\u003e\n        \u003c/\u003e\n    );\n};\n```\n\n## Examples\n\nCheckout live examples on [react-validatable-form-demo](https://obss.github.io/react-validatable-form-demo) page for various customizations.\n\n[Live Examples on StackBlitz](https://stackblitz.com/edit/react-validatable-form)\n\n## Contributing\n\nPlease review the [contributing guide](https://github.com/obss/react-validatable-form/blob/master/CONTRIBUTING.md) before contributing to the repository.\n\n## License\n\nMIT\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobss%2Freact-validatable-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobss%2Freact-validatable-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobss%2Freact-validatable-form/lists"}