@mrzr/react-form-builder
Build React forms from a list of field configs, with react-hook-form. A config says what a field holds, how it is validated, when it is shown, disabled or filled from other fields, and who may see it. The fields are drawn by native HTML out of the box, or by your own components, given once for the whole project.
- Start: Installation · Quick start · Configuration
- Guides: Field types · Validation · Layout · Dependencies · Options · Field arrays · Access and language · Writing components · Hooks · Jalali dates
- Examples:
examples/in the repository — every one compiled and run by the tests - Reference: API
- Help: Troubleshooting · Contributing
Two ways to use it
Section titled “Two ways to use it”Formmakes the form for you: give itfieldsandonSubmit. It starts every field from its config, validates by the configs’ rules, and draws a submit button.FormBuilderdraws the fields of a form you made withuseForm: give itcontrolandsetValue. Use it when the page owns the form, or for part of a form.
Both draw with the plain components unless a project gives its own (Configuration).
Limits
Section titled “Limits”- The plain components are native HTML without styling. A form that should look like your design needs your components (Writing components).
- The plain
comboboxis a text input with suggestions (datalist), and the plain date fields are the browser’s Gregorian pickers holding Jalali values. Real pickers are your components’ job. - A
labeland the other texts are plain strings in the config types. Texts in several languages are resolved at run time, but typing them needs a cast (Access and language). watchandvisiblerules write into the form.FormpassessetValueitself; aFormBuilderneeds it passed (Troubleshooting).