What the component guarantees
- A native checkbox. A real
<input type="checkbox">, visually hidden but focusable, inside a<label>that wraps the box and the text. Clicking the text toggles it and a reader names it from the text. - Indeterminate is real.
indeterminatesets the native property, which readers announce as "mixed". - Disabled is native, and an
NbCheckboxGroupwithdisableddisables every checkbox in it. - A visible focus ring on the drawn box under
:focus-visible. - Group validation reaches every box. Inside an
NbCheckboxGroupwitherror, each checkbox carriesaria-invalid="true", and each points witharia-describedbyat the group's visible message by its id. The group isrole="group"named by itslabel. An error that appears or changes after mount is announced once, withrole="alert"; one present on load is read on focus instead. - A fingertip target on phones. On a phone touch screen the row is 44px tall and the
hit-areamixin gives the box a 44px square, which matters for a box with no label (a table's select column). A desktop is unchanged. - Tested in
tests/Checkbox.test.ts,tests/CheckboxGroup.test.tsandtests/fieldValidationAria.test.ts, and by axe intests/axe.test.ts.
Keyboard
| Key | Action |
|---|---|
| Tab | Moves to the next checkbox |
| Space | Toggles it |
Each checkbox is its own tab stop, as the platform does it. Checkboxes are not a composite.
What you own
- A name for a box without visible text. Put the name in the default slot inside your own visually hidden span ("Select Ada Lovelace"), or the reader hears only "checkbox".
NbDataTable's own select column already does this. - A group label on
NbCheckboxGroupwhen the checkboxes answer one question. - What indeterminate means. A "select all" that is mixed should say how many are selected somewhere a reader can find.
Known gaps
- Attributes you pass (
aria-label,aria-describedby,aria-invalid) land on the wrapping<label>, not on the input, so they do not reach the control. Name it through the slot, as above. - A standalone
NbCheckboxhas noerrororhelperof its own; validation comes from itsNbCheckboxGroup. A single required checkbox ("I accept the terms") cannot carryaria-invalidtoday: wrap it in anNbCheckboxGroupwith the error. - No manual screen reader pass has been recorded for this component.