{"id":16590918,"url":"https://github.com/kdy1/react-forms","last_synced_at":"2025-08-08T04:33:11.748Z","repository":{"id":57334347,"uuid":"247975142","full_name":"kdy1/react-forms","owner":"kdy1","description":"Smart validation for react","archived":false,"fork":false,"pushed_at":"2020-03-26T09:26:37.000Z","size":14,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-06T23:10:24.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/kdy1.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}},"created_at":"2020-03-17T13:21:20.000Z","updated_at":"2021-03-15T08:37:42.000Z","dependencies_parsed_at":"2022-08-31T18:50:48.477Z","dependency_job_id":null,"html_url":"https://github.com/kdy1/react-forms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdy1%2Freact-forms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdy1%2Freact-forms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdy1%2Freact-forms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdy1%2Freact-forms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdy1","download_url":"https://codeload.github.com/kdy1/react-forms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229082282,"owners_count":18017251,"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":[],"created_at":"2024-10-11T23:14:43.847Z","updated_at":"2024-12-10T15:12:05.467Z","avatar_url":"https://github.com/kdy1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React form\n\n## Usage\n\n### Simple usage\n\nIf you **don't use** forms from `@material-ui/core`, run\n\n```js\nnpm i -S react-forms-base\n```\n\n```ts\n// TODO\n```\n\n### Material form fields\n\nIf you **use** `@material-ui/core`, you can easily add validation logic to a `TextField`.\n\n```js\nnpm i -S react-forms-base react-material-fields\n```\n\n```ts\nimport { Form } from \"react-forms-base\";\nimport { useFormState } from \"react-use-form-state\";\nimport { TextFormField } from \"react-material-fields/lib/TextFormField\";\n\nconst MyForm: React.FC = () =\u003e {\n  // This part is optional. You can your own `onChange` and `value`.\n  const [form, { text }] = useFormState\u003cFields\u003e({});\n\n  return (\n    \u003cForm onSuccess={sendToServer}\u003e\n      \u003cTextFormField\n        {...text(\"name\")}\n        label={\"Name\"}\n        validate={v =\u003e {\n          if (!v) {\n            return \"Enter name of the app\";\n          }\n        }}\n      /\u003e\n\n      \u003cTextFormField\n        {...text(\"id\")}\n        label={\"ID\"}\n        validate={v =\u003e {\n          if (!v) return \"Please enter id of the app\";\n          if (v.length \u003c 3)\n            return \"ID of the app should be at least 3 characters\";\n        }}\n      /\u003e\n\n      \u003cButton type={\"submit\"}\u003eCreate\u003c/Button\u003e\n    \u003c/Form\u003e\n  );\n};\n```\n\n![Validation of id](./validation.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdy1%2Freact-forms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdy1%2Freact-forms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdy1%2Freact-forms/lists"}