--- title: Checkbox description: Checkboxes toggle independent options on or off. Use them when each choice is unrelated and more than one can be selected. category: Forms --- import { meta as CheckboxMeta, Default } from '@/content/stories/checkbox'; import Canvas from '@/components/component-docs/canvas'; import Demo from '@/components/component-docs/demo'; export const config = { dependencies: { components: [Canvas, Demo], scripts: [ '../../components/component-docs/demo.script.tsx', '../../components/component-docs/canvas.script.tsx', '../../components/component-docs/controls.script.tsx', ], }, }; # Checkbox

Checkboxes toggle independent options on or off. Use them when each choice is unrelated and more than one can be selected.

## Try it ## Usage Wrap a checkbox in `RuiField` with `RuiLabel` for consistent spacing and error display. Bind `checked` for controlled state. ```tsx import { RuiCheckbox } from '@ecopages/radiant-ui/checkbox'; import { RuiField } from '@ecopages/radiant-ui/field'; import { RuiLabel } from '@ecopages/radiant-ui/label'; Email me product updates ``` ## Custom markup `` coordinates any light-DOM tree that matches its query contract. The `RuiCheckbox` helper stamps these targets; it is not required. ```tsx import '@ecopages/radiant-ui/checkbox'; ``` BEM classes are presentation-only. The host syncs `checked`, `indeterminate`, `disabled`, `value`, `name`, and `aria-checked` on `[data-ref="input"]`. ## Indeterminate selections

Set `indeterminate` when a parent checkbox represents a partially selected group. Clear indeterminate once the user makes an explicit choice.

## Related components

For multiple related options as one form field, use a checkbox group. For mutually exclusive choices, use a radio group.

## Wire through RuiField

Pass `name` on `RuiField` so the checkbox participates in `RuiForm` validation and submission.

## Theming Checkbox chrome maps to **semantic surface roles**, never Tailwind palette steps: | Part / state | CSS roles | | --- | --- | | Box (`rui-checkbox__control`) | `border`, `background`, `rounded-control` | | Checked box | `primary` fill, `on-primary` check glyph | | Indeterminate bar | `primary` on `background` | | Focus | `focus-ring` | | Disabled | `opacity-disabled` | Label text uses `on-background`. Override roles at the theme layer, not in component CSS. ## Accessibility - Every checkbox needs a visible label; use `RuiLabel` or `aria-label`. - Indeterminate state is exposed with `aria-checked="mixed"`. - Disabled checkboxes should include context explaining why the option is unavailable. ## API `RuiCheckbox` renders a `