Checkbox Group
Provides shared state to a series of checkboxes.
Apples
Usage guidelines
- Form controls must have an accessible name: give them one with
<label>elements, or the Field and Fieldset parts. See Labeling a checkbox group.
Anatomy
Checkbox Group is composed together with Checkbox. Import the primitives and assemble the parts:
@using Blazix.Primitives
<CheckboxGroupRoot>
<CheckboxRoot />
</CheckboxGroupRoot>Examples
Labeling a checkbox group
Label the group with aria-labelledby and a sibling label element:
<div id="protocols-label">Allowed network protocols</div>
<CheckboxGroupRoot aria-labelledby="protocols-label">...</CheckboxGroupRoot>An enclosing <label> is the simplest labeling pattern for each checkbox:
<label>
<CheckboxRoot Value="http" />
HTTP
</label>Parent checkbox
A checkbox that controls the other checkboxes in a CheckboxGroupRoot can be created:
- Bind the group's
Value. - Pass the values of all the child checkboxes to the group's
AllValuesparameter. - Set
Parenton the parentCheckboxRoot.
The group sets the parent checkbox's indeterminate state when some, but not all, of the child checkboxes are checked.
API Reference
CheckboxGroupRoot
Renders a <div> element.
Other attributes are passed to the element it renders.