- Docs
- Components
- Forms
Checkbox
Yes or no, or several of a list. It waits for the form's Save; the whole row is the target.
- Import
- @qeetrix/react
- Status
- StableSince 0.0.2
- Renders
<span role="checkbox">Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// From the package: a build keeps only what it uses.
import { Checkbox, CheckboxGroup } from "@qeetrix/react";
// Or from its own path.
import { Checkbox, CheckboxGroup } from "@qeetrix/react/checkbox";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
label | ReactNode | — | The row's label; without one, aria-label is required by its type. |
description | ReactNode | — | A line under the label. |
icon | IconSource | — | An icon before the label; on a tile, in its box. |
checked · defaultChecked · onCheckedChange | boolean | — | Controlled, or to start with. |
indeterminate | boolean | false | Mixed: a dash. |
parent | boolean | false | In a group with allValues: checks them all; a dash while some are. |
value · name · disabled · required | … | — | Its value in a group; as on a form control. |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
checkbox | <div> | The row. |
checkbox-indicator | <span role="checkbox"> | The box: ref and Base UI props land here. |
checkbox-mark | <span> | The tick or the dash. |
04
CheckboxGroup
label is its legend; value is the array of checked values; variant="tile" and columns for tiles.
<CheckboxGroup label="Tell me about" name="events" value={events} onValueChange={setEvents} error={errors.events}>
<Checkbox value="sign-ins" label="New sign-ins" />
<Checkbox value="invites" label="Accepted invites" />
</CheckboxGroup>