-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Form.Field required label #1387
Comments
Thanks for the report. The prop warning is wrong. Shorthand props such as label are disallowed with children. You must either define children only or use shorthand props only and allow the component to define the children for you. This is why the children are not rendered when you add a label prop. The required prop adds a red asterisk to the label and therefore needs a label to be present to work. The prop warning is not accounting for the fact that a user may have passed the label as a child rather than using the label prop. The work around is to use it anyway ignore the prop warning. There is no consequence beyond the warning log. Your code is valid and we will continue to support this markup. The use case the current propType warning is expecting is: <Form.Input label="Email" type="email" name="user[email]" required /> The fix is to relax the label propType validator to allow use without a label prop. |
Can I work on it? |
@nirajk42 Yes, it will be awesome. |
…ut a label prop Fixes Semantic-Org#1387
@nirajk42 @layershifter |
I'm doing the following:
All works fine but I have the warning:
I've tried to use it something like this:
but now I don't see the input.
The file /src/collections/Form/FormField.js has code:
That's why I don't see the input?
How can I get required field with label and input without the warning?
UPDATED
I can reach goal using:
but it leads me to the question:
What are the cases for using
<Form.Field label="Some label">...</Form.Field>
if it doesn't use its children?The text was updated successfully, but these errors were encountered: