Checkbox Group
Checkboxes under one label, with shared helper or error text, and an optional “select all” that turns indeterminate when only some are checked.
Ritla scan of this preview: 41 of 41 checks3 breakpointsScanned
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
Installation
Add the component
npx ritla add checkbox-groupAlso works with shadcn:
npx shadcn@latest add @ritla/checkbox-groupDependencies it brings
@base-ui/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { Checkbox } from "@/components/ui/checkbox";import { CheckboxGroup } from "@/components/ui/checkbox-group";<CheckboxGroup label="Notify me by" value={value} onValueChange={setValue}> <Checkbox value="email">Email</Checkbox> <Checkbox value="sms">Text message</Checkbox></CheckboxGroup>Examples
Error
error marks every box and puts the message under the group.
API reference
CheckboxGroup
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | None | Figma's Label, as the legend. |
value / defaultValue | string[] | None | Values of the checked boxes. |
onValueChange | (value: string[]) => void | None | On every toggle. |
allValues | string[] | None | Every value, for “select all” (<Checkbox parent>). |
required / helperText / error / disabled | … | None | As on Input Field. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| TabSpace | Tab between boxes; Space toggles. |
ARIA
- A
fieldsetwith alegend; the helper text or error is linked to the group. - “Select all” is
aria-checked="mixed"when some children are checked.
Arabic and RTL notes
Mirrors
- The boxes sit at the inline start (the right).
Does not mirror
- The checks never mirror.
- Numerals
- No numbers.
- Arabic typography
- The label is
label-12, optionslabel-16Medium.
Checks it passes
The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.
- Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
- letter-spacing applied to Arabic text (breaks the connected script)
- Clipped text: content wider than its box with overflow hidden and no ellipsis
- Fixed-pixel-width container whose Arabic text exceeds the space