-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
TimeInput: Add label
prop
#63106
TimeInput: Add label
prop
#63106
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Tested with and without a label - works as expected, thanks! 🚀
/** | ||
* The label for the time input. | ||
*/ | ||
label?: string; |
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.
Should we consider making the label
required by default, so that when the input is used standalone consumers are nudged towards labelling it? We could disable the rule when compositing is in DateTimePicker
.
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.
I don't think it's a huge issue for this one specifically, because the hours and minutes inputs are both labeled.
In the general case though (re: #51740), I'm starting to think that an eslint rule for our repo might be a good way to nudge devs without compromising the "truthfulness" of our TS types.
* TimeInput: Add `label` prop * Add changelog Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
Part of #52734
Follow-up to #60613
What?
Adds a
label
prop toTimeInput
.Why?
Since some people will be using this as an alternative to
TimePicker
, we need a way to add a visual label as well. (Technically, it needs to be a fieldset legend rather than alabel
.)Testing Instructions
See Storybook for TimeInput to test behavior.
(Code changes are easier to review with whitespace hidden)