-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Grafana/ui: Expose trigger method from useForm
to children
#73831
Conversation
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.
Looks good! 🎉
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.
LGTM!
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.
Is this change related to some issue or do you need it for some other task that may be worth mentioning in the PR description?
I added the issue where this change will be used 👍 |
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.
Thanks for adding more details. Now it looks like you are good to go.😃
…#73831) Form: Expose trigger method from useForm to children
Form: Expose trigger method from useForm to children
What is this feature?
This PR exposes the
trigger
method fromuseForm
to the children components ofForm
.Why do we need this feature?
(Link to docs) It allows to manually trigger form validation. A workaround can be made when
trigger
not available, but there is no real reason not to expose this method to the children components.Almost all the other methods from
useForm
are returned, so it makes sense to also return this one.For example, when building a Stepper component, you might need to trigger validation of the whole form on the last step to ensure there are no errors.
Who is this feature for?
Users of the
Form
component from@grafana/ui
.Which issue(s) does this PR fix?
Fixes issue #94.