{"id":18613053,"url":"https://github.com/eduzz/ui-antd-hooks-form","last_synced_at":"2025-08-22T13:45:55.531Z","repository":{"id":180440731,"uuid":"664780497","full_name":"eduzz/ui-antd-hooks-form","owner":"eduzz","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-29T15:18:11.000Z","size":334,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-17T17:18:54.962Z","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/eduzz.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-10T18:23:43.000Z","updated_at":"2024-08-29T15:17:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"09dd24ff-185c-419c-b806-9e0231fafdb7","html_url":"https://github.com/eduzz/ui-antd-hooks-form","commit_stats":null,"previous_names":["eduzz/ui-antd-hooks-form"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduzz%2Fui-antd-hooks-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduzz%2Fui-antd-hooks-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduzz%2Fui-antd-hooks-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduzz%2Fui-antd-hooks-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eduzz","download_url":"https://codeload.github.com/eduzz/ui-antd-hooks-form/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248316237,"owners_count":21083408,"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-11-07T03:19:42.448Z","updated_at":"2025-04-10T23:31:46.969Z","avatar_url":"https://github.com/eduzz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eduzz Hooks: Antd React Hooks Form\n\n[![version](https://img.shields.io/npm/v/@eduzz/ui-antd-hooks-form)](https://www.npmjs.com/package/@eduzz/ui-antd-hooks-form)\n[![size](https://img.shields.io/bundlephobia/min/@eduzz/ui-antd-hooks-form)](https://www.npmjs.com/package/@eduzz/ui-antd-hooks-form)\n\nImplementação padrão do **react-hook-form** para validação de formulário com AntD.\n\n## Instalação\n\n```bash\nyarn add @eduzz/ui-antd-hooks-form\n```\n\n## Tecnologias\n\n- [react-hook-form](https://react-hook-form.com)\n- [yup](https://github.com/jquense/yup): Schema de validação\n\n## Como usar\n\n\u003e Não é necessário o register de cada componente quando o **Form** componente é instanciado.\n\n```tsx\nimport useForm, { FormModel } from '@eduzz/ui-antd-hooks-form/useForm';\n\nconst form = useForm({\n  defaultValues: {\n    // Não é necessário iniciar os valores\n    money: 5\n  },\n  validationSchema: yup =\u003e  {\n    // Caso não use uma schema pronto o yup será passado via arg\n    return yup.object({\n      name: yup.string(),\n      money: yup.number().min(10)\n    }),\n  }\n});\n\n// O FormModel é útil caso tenha criado uma schema nova no validationSchema\n// do contrário o ideal é o infer do yup.\nconst onSubmit = useCallback((data: FormModel\u003ctypeof form\u003e) =\u003e console.log({data}))\n\n\u003cForm context={form} onSubmit={data =\u003e console.log(data)}\u003e\n  \u003cInput label='Name' name='name' /\u003e\n  \u003cCurrency label='Money' name='money' /\u003e\n\n  \u003cButton type='submit'\u003eSubmit\u003c/Button\u003e\n\u003c/Form\u003e\n```\n\n## Parametros\n\nO único parametro especifico é o validationSchema, o resto é configuração padrão do [react-hook-form](https://react-hook-form.com/api/useform).\n\n| prop             | tipo       | obrigatório | descrição                              |\n| ---------------- | ---------- | ----------- | -------------------------------------- |\n| validationSchema | `function` | `true`      | Utilizado para validação do formulário |\n\n## Componentes\n\n- [Input](https://github.com/eduzz/ui-hooks/blob/master/Input/index.md).\n- [Textarea](https://github.com/eduzz/ui-hooks/blob/master/Textarea/index.md).\n- [Select](https://github.com/eduzz/ui-hooks/blob/master/Select/index.md).\n- [DatePicker](https://github.com/eduzz/ui-hooks/blob/master/DatePicker/index.md).\n- [TimePicker](https://github.com/eduzz/ui-hooks/blob/master/TimePicker/index.md).\n- [Checkbox](https://github.com/eduzz/ui-hooks/blob/master/Checkbox/index.md).\n- [Radio](https://github.com/eduzz/ui-hooks/blob/master/Radio/index.md).\n- [Switch](https://github.com/eduzz/ui-hooks/blob/master/Switch/index.md).\n- [ErrorMessage](https://github.com/eduzz/ui-hooks/blob/master/ErrorMessage/index.md).\n- [Form](https://github.com/eduzz/ui-hooks/blob/master/Form/index.md).\n\n## Tipando o nome\n\nEm todos os componentes é possível passar uma interface para poder tipar o name:\n\n```tsx\n\u003cInput\u003cFormModel\u003ctypeof form\u003e\u003e label='Name' name='name' /\u003e\n\u003cInput\u003cUser\u003e label='Name' name='name' /\u003e\n\u003cInput\u003cUser\u003e label='Name' name='nivel.0.name' /\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduzz%2Fui-antd-hooks-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feduzz%2Fui-antd-hooks-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduzz%2Fui-antd-hooks-form/lists"}