-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(FormGroup): use inject instead of cloning slots #491
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
name: { | ||
type: String, | ||
default: null | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can depreciate this props since it's now only used for validation and rename it to path
to make the documentation clearer.
The two can coexist by setting the validation path to props.path ?? props.name
to avoid breaking changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need it to bind on the <label :for="name">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if the input is wrapped into the label like I mentioned in the description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely missed that sorry, it's awesome! Nice found 😊
Just made this commit 83c42cd that fixes the size on the Do you need me to solve the conflicts? |
I'll do it if you're good with the changes, I need adapt the other input components too |
✅ Live Preview ready!
|
This is a proposal to refactor the FormGroup component. It replaces vProps / slot manipulations by injecting relevant attributes directly into the children components.
This allows the use of v-slots (fixes #484) and provides an easy way to make custom input components compatible with the Form / FormGroup components using
useFormGroup
.I also replaced how labels and inputs are bound by nesting them directly, to avoid conflicts with duplicate ids c.f.