-
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
FormField support label
shorthand
#939
Comments
Could you provide a codepen? The rendered HTML needs to be inspected in this case. |
Hi @levithomason ! |
@GautierT You pass HTML as string while you should pass it as JSX expression: <DefaultRadio label={<b>This should bold</b>} /> |
😳 Of course... Thanks @layershifter |
@layershifter : I tried your code. It's working but now i have an error. (I failed to reproduce it in the codepen or in the doc... ) |
Thanks for the report. The codepen uses the minified build which does not log prop type warnings. The component currently will render any node the way it is written, but it is intended to be a string as the value of the I would accept a PR that updates the FormField label prop to use a shorthand factory: htmlLabel.create(props.label)
// vs the current
<label>{props.label}</label> This way you can pass string, number, props object, or another element and it will work correctly with valid markup: label='my label' // <label>my label</label>
label={123} // <label>123</label>
label={{ children: 'foo' }} // <label>foo</label>
label={<div className='label' />} // <div class="label"></div>
label={<MyComponent />} // ...what ever your component renders |
label
shorthand
I've updated the issue to reflect my latest comment on this. |
I would like to pass some html to my label in my radio button. But the html is not rendered.
Field
is a specific component from redux-formExpected Result
.... Value : 0
Actual Result
.... Value : 0
Version
0.58.2
The text was updated successfully, but these errors were encountered: