Skip to content

Checkbox Group

Get Ritla UI

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

Open in Figma

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add checkbox-group

    Also works with shadcn: npx shadcn@latest add @ritla/checkbox-group

  2. Dependencies it brings

    @base-ui/react

  3. Or 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

checkbox-group.tsx
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.

EnglishMirroredArabic
LTR →

API reference

CheckboxGroup

PropTypeDefaultDescription
labelReactNodeNoneFigma's Label, as the legend.
value / defaultValuestring[]NoneValues of the checked boxes.
onValueChange(value: string[]) => voidNoneOn every toggle.
allValuesstring[]NoneEvery value, for “select all” (<Checkbox parent>).
required / helperText / error / disabled…NoneAs 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.

KeyAction
TabSpaceTab between boxes; Space toggles.

ARIA

  • A fieldset with a legend; 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, options label-16 Medium.

Checks it passes

The Ritla checks this component satisfies by construction. Used as documented, it does not bring these defects onto your page.

  • R050Arabic text falling back past the declared font family (measured, declared, or a webfont that failed to load)
  • R051letter-spacing applied to Arabic text (breaks the connected script)
  • R042Clipped text: content wider than its box with overflow hidden and no ellipsis
  • R043Fixed-pixel-width container whose Arabic text exceeds the space