Closed joelanman closed 1 year ago
@joelanman Can you provide a link to that in the docs, as that looks like it needs correcting? It should read:
conditional | boolean | If true, content provided will be revealed when the item is checked.
conditional.html | string | Provide content for the conditional reveal.
(which I can see on https://design-system.service.gov.uk/components/checkboxes/)
Good point about being able to provide a text
option though, that definitely seems to better match what we do elsewhere.
It was radios I was looking at:
https://design-system.service.gov.uk/components/radios/
I would say even boolean
is a bit confusing, as the examples don't use a boolean, they use an object
For now we've agreed just to remove the conditional
entry from the macro options for radios and checkboxes, which will make it consistent to the way the accordion works and is documented (apart from not supporting conditional.text
).
The documentation around this is still a bit off as it still suggests setting conditional
with a text value would work, which it definitely doesn't judging by the code below:
Documentation reference: https://design-system.service.gov.uk/components/radios/
The macro options for radios and checkboxes still display the conditional
parameter. Do we need to remove these instances?
just come across this again in my work - conditional
is still listed as a string
option, and as boolean
in checkboxes, both should probably be removed
thanks!
I was trying to use the conditional option on radios.
I saw that the example used
I didn't need html, just a sentence so I thought I could use
text
instead ofhtml
as you can in other places in Frontend. However, I tried it and it didn't work - there's no text option here.When I re-read the docs, I misread and thought the 'conditional' option, being a string, could just accept text.
However, I misread it, that doesn't work - the docs actually say:
But I don't think this is correct? In the examples,
conditional
is not a string, it's an object with only one property -html
I wonder if this might be better as two options:
conditionalHTML
andconditionalText
This would avoid another object, and be more consistent with the use of HTML and text elsewhere?