The RadioGroup component is used for displaying a list of related options, in the form of Radio inputs, where only one choice can be selected.
In a React app, the component can be imported via:
In an Ember app, the component is named PlumaRadioGroup.
A RadioGroup should contain Radio components as children. RadioGroup will forward
the name attribute to any Radios nested within, as well as connect onChange
handlers to them, so there's no need to define those props on the Radios themselves:
Or, in Ember:
A RadioGroup must always have an associated label. The component accepts a label
string prop, which renders text above the nested radios.
Alternatively, ariaLabelledby may be used to associate the group with a label
elsewhere in the DOM. To make sure the association is set up both ways, it's recommended
to also set for on the label, pointing to an id on the radio group:
Finally, the ariaLabel prop can be used if no other element is suitable for
a label.
The isDisabled prop on a RadioGroup will take precedence over the isDisabled
prop on individual Radio components.
It is not necessary to set isDisabled on the individual Radio components, as
the RadioGroup provides that state to the Radios through its context.
PlumaRadioGroup extends BoxThe aria-label attribute to be applied on the fieldset
The aria-labelledby attribute to be applied on the fieldset
An optional id attribute to assign to the fieldset
Whether the entire group is disabled
The label text to be shown above the radio group
The name shared by radios in this group. If none is provided, one will be generated
Called when the value changes
The current value