{"id":20301571,"url":"https://github.com/zero-one-group/form-builder","last_synced_at":"2025-10-05T19:30:08.801Z","repository":{"id":57093302,"uuid":"463499025","full_name":"zero-one-group/form-builder","owner":"zero-one-group","description":"Simplify large form","archived":false,"fork":false,"pushed_at":"2022-12-27T02:30:51.000Z","size":431,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-23T10:54:39.867Z","etag":null,"topics":["form","formgenerator","formik","formikformgenerator"],"latest_commit_sha":null,"homepage":"https://zero-one-group.github.io/form-builder","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zero-one-group.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-25T10:57:47.000Z","updated_at":"2023-01-05T08:22:03.000Z","dependencies_parsed_at":"2023-01-31T02:30:55.318Z","dependency_job_id":null,"html_url":"https://github.com/zero-one-group/form-builder","commit_stats":null,"previous_names":["zero-one-group/zero-form-builder"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-one-group%2Fform-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-one-group%2Fform-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-one-group%2Fform-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zero-one-group%2Fform-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zero-one-group","download_url":"https://codeload.github.com/zero-one-group/form-builder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248410159,"owners_count":21098772,"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":["form","formgenerator","formik","formikformgenerator"],"created_at":"2024-11-14T16:26:34.534Z","updated_at":"2025-10-05T19:30:08.727Z","avatar_url":"https://github.com/zero-one-group.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# @01group/form-builder\n\nThis is a lightweight react hook library to simplify approach in building formik form.\n\n## Story behind\nIn our cases, we often found our development process was couples doing process in order to building form.\n\nWe find a better approach to make this more efficiency.\n\n## Installation\n```bash\nyarn add @01group/form-builder\n```\n\nor if you prefer to choose `npm`\n\n```bash\nnpm install -S @01group/form-builder\n```\n\n## Usage\nThis main library is using a react hook `useZeroForm`. It will return `fields` and `values`.\n\n\n### Description\n**fields**: list of object field that useful to handle form\n\n**values**: object of value, it could be to fill `initialValues` in `formik`\n\n\n### Example\n**Nb.** Below is our approach. You might used your own, if you think this not suit enough for you.\n\n```typescript\nimport { Formik, Form } from 'formik'\nimport { useZeroForm, ZeroFormTypes } from '@01group/form-builder';\n\nexport const DATA = {\n  name: '',\n  province_id: '',\n  city_id: '',\n  date_of_birth: '',\n};\n\nexport const generalOptions = {\n  name: {\n    type: 'text',\n    label: 'Your name',\n    isRequired: true,\n  },\n  province_id: {\n    type: 'select',\n    label: 'Province',\n    placeholder: 'Select a province',\n  },\n  city_id: {\n    type: 'select',\n    label: 'City',\n    placeholder: 'Select a city',\n  },\n};\n\nexport function Example() {\n  const { fields, values } = useZeroForm({ data: DATA as ZeroFormTypes, options: generalOptions });\n\n  return (\n    \u003cFormik\n      initialValues={values}\n      validationSchema={validationSchema}\n      onSubmit={handleSubmit}\n      enableReinitialize\n    \u003e\n      \u003cForm\u003e\n        {(fields ?? []).map((field, i) =\u003e (\n          \u003cGenerateField key={i} isReadonly={isReadonly} {...field} /\u003e\n        ))}\n      \u003c/Form\u003e\n    \u003c/Formik\u003e\n  )\n}\n\nexport function GenerateField(props: ZeroFieldItem) {\n  const inputProps = {\n    id: props.name,\n    name: props.name,\n    label: props.label,\n    placeholder: props.placeholder,\n    isRequired: props.isRequired,\n    isReadOnly: props.isReadonly,\n  };\n  const selectProps = {\n    ...inputProps,\n    items: props.selectOptions ?? [],\n  };\n\n  const elements: Partial\u003cRecord\u003cPartial\u003cZeroFieldTypes\u003e, JSX.Element\u003e\u003e = {\n    select: \u003cSelect {...selectProps} /\u003e,\n    text: \u003cTextField {...inputProps} /\u003e,\n    row: \u003cTextarea {...inputProps} /\u003e,\n    file: \u003cDropzone width=\"full\" {...inputProps} /\u003e,\n  };\n\n  return elements[props.type] ?? \u003cTextField {...inputProps} /\u003e;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-one-group%2Fform-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzero-one-group%2Fform-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzero-one-group%2Fform-builder/lists"}