Skip to content

Conversation

@zAlweNy26
Copy link
Contributor

In my opinion it is better to align with the NuxtUI Form component emits and exposed methods for better compatibility. Hope it helps.

Closes #15

@Norbiros
Copy link
Owner

I am not huge fan of changing the AutoForn component, I tried to make it have the best DX out of the box, so you can avoid code duplication with things like changing variant of the submit button.

But I see that in some use cases you want to have something identical to @nuxt/ui's version and I think the best solution would be to create a new component (primitive auto form), that will be used inside original AutoForm, but is also accessible to use in your project. What do you think about this idea?

@zAlweNy26
Copy link
Contributor Author

It can be a solution, but I don't really understand why you are not a fan of changing the AutoForm component. The module is in beta, and it has a strong connection with NuxtUI so to me it was pretty obvious that I could access the same primitives.
Is there something I am missing?

@Norbiros
Copy link
Owner

It isn’t about introducing a breaking change.
The main goal of this module is to provide a system for auto-generating forms from Zod schemas, while also improving the overall form experience in Nuxt.

That’s why:

  • I added a loading button feature
  • I plan to improve the modals.
  • I return an object instead of an event, so you don’t need to call event.preventDefault() manually.

Many form use cases are similar, so it makes sense to build an abstraction around them. The current approach uses an AutoForm component with a slightly improved DX, but in the future this module might also handle sending full form data requests and displaying toasts automatically.

Since the Nuxt UI forms system isn’t perfect, this module aims to serve two groups of developers: those who want higher-level abstractions with sensible defaults and those who just want a drop-in replacement for @nuxt/ui forms, without extra features (like you).

It won't be hard to maintain and it would resolve probably use cases, so I don't see any downsides of my solution

@zAlweNy26
Copy link
Contributor Author

Thanks for the explanation. I now understand your view and agree with it, I'll try to move the changes I made to another component, how would you like to call it?

@Norbiros
Copy link
Owner

I am not sure... Currently all the components start with letter "A", so maybe AutoFormBase (or AutoFormPrimitive)? We could rename the current component and name the new one AutoForm, but we still need to find a name for the current one...

After some consideration I think AutoFormPrimitive is the best one, but I am not 109% sure

@zAlweNy26
Copy link
Contributor Author

I was more on the AutoFormBase side, but you decide ahah

@Norbiros
Copy link
Owner

I'll create a pool on an undisclosed Discord server with some Nuxters, so we can ask more people for opinion :3 For now you can use either of those names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Add the 'error' emit event to AutoForm

2 participants