Checkbox/Radio enable them to be required
Is your feature request related to a problem? Please describe. Unable to require a group of radio or checkboxes to be selected on a form
Describe the solution you'd like
Support optional prop for RadioGroup and CheckboxGroup
Thanks @liywjl. For RadioGroup, we can apply the required attribute to each radio element. We can add a radiogroup role to the fieldset and apply the aria-required attribute if the optional prop is not specified.
Have you had instances when it has been necessary for CheckboxGroup to be required i.e. at least one checkbox must be selected from a group? I can imagine instances where a single checkbox must be selected, for instance to indicate that a user accepts some T&Cs.
Yes I think supporting required for both RadioGroup and CheckboxGroup would be super useful. Currently we have an issue with not being able to enfore required in checkbox on a callout:
https://www.theguardian.com/politics/2020/may/05/boris-johnson-boasted-of-shaking-hands-on-day-sage-warned-not-to?dcr
I think as well for what you metioned a T&C checkbox would be super useful. Another area where this would be useful would be for the Quiz Atoms that we are looking at supporting.
Great, thanks so much for the extra context @liywjl, we are happy to support this feature. It would be great for consistency too. Would you be up for raising a PR?