The CheckboxGroup component is used for displaying a list of related options, in the form of Checkbox inputs, where multiple choices may be selected.
In a React app, the component can be imported via:
In an Ember app, the component is named PlumaCheckboxGroup.
A CheckboxGroup should contain Checkbox components as children. CheckboxGroup
will forward the name attribute to any Checkboxes nested within, as well as
connect onChange handlers to them, so there's no need to define those props
on the Checkboxes themselves:
Or, in Ember:
A CheckboxGroup must always have an associated label. The component accepts a label
string prop, which renders text above the nested checkboxes.
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 checkbox group:
Finally, the ariaLabel prop can be used if no other element is suitable for
a label.
The isDisabled prop on a CheckboxGroup will take precedence over the isDisabled
prop on individual Checkbox components.
It is not necessary to set isDisabled on the individual Checkbox components, as
the CheckboxGroup provides that state to the Checkboxes through its context.
PlumaCheckboxGroup 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 checkbox group
The name shared by checkboxes in this group. If none is provided, one will be generated
Called when the value changes
An array of the currently selected values