jaredpalmer / formik

Build forms in React, without the tears 😭
https://formik.org
Apache License 2.0
33.98k stars 2.79k forks source link

Add Documentation on Dynamic Forms #2729

Closed HiranmayaGundu closed 3 years ago

HiranmayaGundu commented 4 years ago

📖 Documentation

A common use case that I have is that the fields I have in my form will differ based on one of the inputs. The difference from the <FieldArray /> usecase and this is that I do not know before hand what components are being added. I.e., I'm rendering a completely different set of components based on the value selected by the user.

It is possible to build such forms using Formik, but it's not clear how to.

Here are some example issues that showcase the things you need to collect together to build such a form:-

These are certain things that if documented I think could help:-

  1. How to remove a field from the form by using setFieldTouched and setFieldValue
  2. How to dynamically add validation / Best practices on whether to use validationSchema or validate at the field level
  3. How to dynamically change the name prop
  4. How to dynamically set initalValues / Best practices on setting initial value at field level

I think adding documentation under the Guides section would be helpful!

I'd love to help add this if it makes sense.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days