Replies: 1 comment 1 reply
-
Hi! Thanks for your post.
I used
That's intended and I think makes sense for how the rest of the library works. I don't think there's a need to add something like that but I could be wrong. The use case for objects in this library is for defining complex input types, which in theory should have a well defined schema ahead of time.
We can implement a component that can dynamically add and remove array elements The primary goal of this library is to reduce the work required when implementing a new form to just defining the schemas required for that form. In my experience, a lot of forms just require doing this:
So, this library is just meant to get rid of steps 2 and 3. The main purpose is to just allow devs to define forms faster but allow enough customization to meet varied design requirements easily. We now support defining layouts easily =D, still need to add documentation on that feature but it should handle any layout since it just allows writing plain JSX for the layout |
Beta Was this translation helpful? Give feedback.
-
I'll preface this by saying: great work on the library!! I love seeing how other people approach similar problems.
How I got here
A few weeks ago I ran across a Twitter thread that mentioned declarative form building using a Zod schema. Since I've used JSON schema based form libraries before, I was aware of the amazing DX that can be achieved by building forms declaratively, and I started imagining how great it could be with Zod, given it's excellent contribution to type safety.
I tried to find a library that does this but didn't manage to. I guess I couldn't find your library because I was searching for keywords such as "zod form", "zod schema form", "zod declarative form", but this library doesn't mention "zod" in the name.
So, armed with my prior JSON schema form knowledge and a bunch of motivation, I set out to build my own! Two weeks later, I put ZodForm out there. I posted about it in the T3 discord channel, where someone told me about this library, so I decided to take a look.
Goals & Tradeoffs
I am writing this so that we can have a discussion about the goals (common or non-common) of the two (seemingly similar) libraries.
ZodForm's goals
Form
component which can render a form given a set of pre-configured components. Once the user pre-configures the components, it should require minimal effort to render complex forms using them. For this, it implements:My questions about
react-ts-form
react-hook-form
? This is very interesting to me because I didn't think of using RHF to manage the form internally.. and the more I think of it, the more I see it as a good ideareact-ts-form
intend to implement dynamic object rendering? When I tried it, it seemed to require me to register every possible object shape as a custom componentreact-ts-form
intend to implement dynamic array rendering?Conclusion
I opened this discussion for two reasons:
All that being said, I'm excited to hear your thoughts!
Beta Was this translation helpful? Give feedback.
All reactions