TanStack / form

🤖 Powerful and type-safe form state management for the web. TS/JS, React Form, Solid Form, Lit Form and Vue Form.
https://tanstack.com/form
MIT License
3.77k stars 341 forks source link

[Docs] Guide about dynamic forms & nested fields #481

Open juliendelort opened 1 year ago

juliendelort commented 1 year ago

A common use case with forms is showing or hiding fields based on other field’s values. For example, a “select a reason” form that has an “other” checkbox that shows an extra textarea (”please specify”) when checked.

Nested fields should be covered as well: For example, if a specific field is of type string[] and I need to have an input for each entry (and a “add item” button that adds a new input), how should I handle it? Do I need a data transformation layer?

More about nested fields: https://informel.site/nested_fields

crutchcorn commented 1 year ago

Love this, yeah. We support this today using the index field, but we also could use some more tests to validate this functionality as well.

For anyone working on these docs, be aware that this functionality may change before v1.0. Not a blocker for documenting, just that it may need updating in the future