Support HTML in legend, label and error props, prepare beta release#294
Support HTML in legend, label and error props, prepare beta release#294colinrotherham merged 23 commits intoNHSDigital:mainfrom
Conversation
This will hopefully fix that the hint text can be string as well as an element (which is supported).
|
Thanks @Peter-Hudson-G 🙌 Good thinking. Would you mind doing the same for To prevent accessibility issues, can you please add some tests (and new storybook examples) using phrasing content only? For example, adding Text onlyYou would have got these vaccinations at school, from your GP surgery or another healthcare providerHTML contentThis is a 10 digit number (like <span class="nhsuk-u-nowrap">999 123 4567</span>) that you can find on an NHS letter, prescription or in the NHS AppThen we can get this into the next beta release |
|
Looks like we need it for For consistency with NHS.UK frontend where both text and HTML are supported |
|
It's escalated a little bit from one file. Should hopefully now reflect what I interpenetrated your review meant @colinrotherham . |
Co-authored-by: Colin Rotherham <work@colinr.com>
Co-authored-by: Colin Rotherham <work@colinr.com>
Co-authored-by: Colin Rotherham <work@colinr.com>
Co-authored-by: Colin Rotherham <work@colinr.com>
…o fix merge conflicts)
1ae09a4 to
efe8f48
Compare
efe8f48 to
71e9f13
Compare
|
Hope you didn't mind but I've gone ahead and added I've also swapped | number
| bigint
| boolean
| Iterable<React.ReactNode>
| React.ReactPortal
| Promise<AwaitedReactNode>
| nullI'm very aware that teams might have seen the new storybook examples as ready-to-use in production so I've only included heading caption examples. Full coverage for the other types can be found in tests though Are you happy with the PR as is it now? |
|
Hi @colinrotherham , Looks good. I guess thinking about it the |
Do you have worries about that bit? Once this PR is merged, error messages will match hint, label and legend behaviour: nhsuk-react-components/src/components/form-elements/label/Label.tsx Lines 20 to 22 in 71e9f13 nhsuk-react-components/src/components/form-elements/legend/Legend.tsx Lines 22 to 24 in 71e9f13 |
|
Not at all. If you're now fixing it to string or an element a boolean true or number won't sneak past. I came close to using the same thing, but just thought ReactNode covered both nicely. |
|
|
Thanks @Peter-Hudson-G, this is now released in v6.0.0-beta.4 |
|
Cheers @colinrotherham . My TypeScript is now happy. |



This will hopefully fix that the hint text can be string as well as an element (which is supported).