---
title: "Checkbox"
description: "Lets people turn one independent choice on or off, show a parent choice that is only partly on, and mark a required choice left unmade."
url: "https://tanrei.chnotchy.com/components/checkbox/"
last_updated: 2026-10-23T21:17:12.000Z
---

# Checkbox

> Lets people turn one independent choice on or off, show a parent choice that is only partly on, and mark a required choice left unmade.

## Overview

### Usage

The revision that gave the checkbox its present sizes and the icon set’s glyphs changed only how it looks and moves, so every sample below is current. The web draws and animates it as the spec says. SwiftUI, Compose, Flutter and React Native are lagging: they already take the new sizes, but still draw the check and the dash as marks of their own and animate them in their own way until they catch up. Two refinements since then are on the web only so far: the check and the dash have a heavier weight of their own, and the box’s outline and fill are drawn as one shape.

**Web**

```html
<tanrei-checkbox label="Email me updates"></tanrei-checkbox>
<tanrei-checkbox checked label="Email me updates"></tanrei-checkbox>

<!-- A parent whose children are mixed. Activating it checks it and clears indeterminate. -->
<tanrei-checkbox indeterminate label="Select all"></tanrei-checkbox>

<!-- In a form it submits value (default "on") under name while checked, and honours required. -->
<form>
  <tanrei-checkbox name="terms" required label="I accept the terms"></tanrei-checkbox>
</form>

<script type="module">
  import '@tanrei/web/components/checkbox';
  // The element switches its own checked before it fires change.
  document.querySelector('tanrei-checkbox').addEventListener('change', (e) => save(e.detail.checked));
  const terms = document.querySelector('[name="terms"]');
  terms.error = submitted && !terms.checked;
</script>
```

**React**

```tsx
import { Checkbox } from '@tanrei/react';

<Checkbox checked={updates} label="Email me updates" onChange={(e) => setUpdates(e.detail.checked)} />
<Checkbox checked={all} indeterminate={some && !all} label="Select all" onChange={(e) => selectAll(e.detail.checked)} />
<Checkbox checked={terms} error={submitted && !terms} label="I accept the terms" onChange={(e) => setTerms(e.detail.checked)} />
```

**SwiftUI**

```swift
import Tanrei

TanreiCheckbox("Email me updates", isOn: $updates)

// isIndeterminate comes from your data. Activating it sets isOn to true; your data then clears it.
TanreiCheckbox("Select all", isOn: $allSelected, isIndeterminate: someSelected)
```

**Compose**

```kotlin
import androidx.compose.ui.state.ToggleableState
import io.github.chnotchy.tanrei.components.TanreiCheckbox

TanreiCheckbox(checked = updates, onCheckedChange = { updates = it }, label = "Email me updates")

// A parent that can be partly on takes a ToggleableState. The caller computes the next state:
// activating an indeterminate checkbox makes it On.
TanreiCheckbox(
    state = allState,
    onClick = { selectAll(allState != ToggleableState.On) },
    label = "Select all",
)

TanreiCheckbox(
    checked = terms,
    onCheckedChange = { terms = it },
    label = "I accept the terms",
    isError = submitted && !terms,
)
```

**Flutter**

```dart
import 'package:tanrei/tanrei.dart';

TanreiCheckbox(
  value: updates,
  onChanged: (bool value) => setState(() => updates = value), // null disables it
  label: 'Email me updates',
);

// With tristate, a null value is indeterminate. Activating it calls onChanged(true).
TanreiCheckbox(
  value: allSelected, // bool?: null while only some are selected
  tristate: true,
  onChanged: (bool value) => setState(() => selectAll(value)),
  label: 'Select all',
);

TanreiCheckbox(
  value: terms,
  onChanged: (bool value) => setState(() => terms = value),
  isError: submitted && !terms,
  label: 'I accept the terms',
);
```

**React Native**

```tsx
import { Checkbox } from '@tanrei/react-native';

<Checkbox value={updates} onValueChange={setUpdates} label="Email me updates" />
<Checkbox value={all} indeterminate={some && !all} onValueChange={selectAll} label="Select all" />
<Checkbox value={terms} onValueChange={setTerms} error={submitted && !terms} label="I accept the terms" />
```

## Specs

In the default system the checkbox is an 18 box with a 2 outline and a 2 corner, on a round 40 state layer, with a 48 target. With a label it is 40 tall. The check and the dash are the glyphs `check` and `remove` of the system’s icon set, drawn at 20 over the box. They have a weight of their own, heavier than the system’s other icons: 500 in the default system, where the icons are 300. At this size a stroke of the icons’ weight is about one pixel wide and hard to see, so the mark is heavier while its size stays the same. A preset keeps its own icon weight. The checkbox draws no mark of its own, so a design system that changes its icon set changes these glyphs with every other. The outline and the fill of the box are one shape: nothing behind the box shows between them at any zoom or display density, and a checked box is one even color from its edge to its mark. Under `cupertino` the checkbox keeps its smaller box and a 16 glyph.

When the checkbox changes, the box, the outline and the glyph change color, and a glyph that appears fades in while it grows from half its size, settling with a slight overshoot. A glyph that goes fades out and shrinks the same way, and between checked and indeterminate the check goes while the dash comes. Only the glyph moves: the box never changes size or position. A checkbox drawn for the first time shows its condition at once, so a page that loads with ticked boxes does not animate them. Where motion is reduced, the new condition is drawn whole in the next frame.

- Category: Selection
- Level: base
- Listing: default
- Used in: Checkbox group
- Page: https://tanrei.chnotchy.com/components/checkbox/
- Spec: https://github.com/chnotchy/tanrei/blob/main/specs/checkbox.spec.json

### Availability

| Design system | Has it | Notes |
| --- | --- | --- |
| Tanrei (`tanrei`) | Yes | — |
| Cupertino (Apple HIG-inspired) (`cupertino`) | Yes | — |
| M3 Expressive-like (Material 3 Expressive-inspired) (`m3-expressive-like`) | Yes | — |
| M3-like (Material 3-inspired) (`m3-like`) | Yes | — |

### Platforms

- Web: the element `<tanrei-checkbox>`, registered by importing `@tanrei/web` (or only its own module, `@tanrei/web/components/checkbox`).
- React: `Checkbox` from `@tanrei/react`.

| Platform | Name | Status |
| --- | --- | --- |
| Web | `tanrei-checkbox` | lagging |
| SwiftUI | `TanreiCheckbox` | lagging |
| Jetpack Compose | `TanreiCheckbox` | lagging |
| Flutter | `TanreiCheckbox` | lagging |
| React Native | `Checkbox` | lagging |

Names a platform gives in its own idiom:

| Spec | Web | SwiftUI | Jetpack Compose | Flutter | React Native |
| --- | --- | --- | --- | --- | --- |
| `checked` (prop) | `checked` | `isOn` | `checked` | `value` | `value` |
| `indeterminate` (prop) | `indeterminate` | `isIndeterminate` | `state` | `tristate` | `indeterminate` |
| `error` (prop) | `error` | `isError` | `isError` | `isError` | `error` |
| `disabled` (prop) | `disabled` | `disabled` | `enabled` | `onChanged` | `disabled` |
| `label` (prop) | `label` | `title` | `label` | `label` | `label` |
| `labelHidden` (prop) | `labelHidden` | `labelsHidden` | `labelHidden` | `labelHidden` | `labelHidden` |
| `change` (event) | `change` | `isOn` | `onCheckedChange` | `onChanged` | `onValueChange` |

Statuses: `planned` — In the inventory. Nothing shippable exists yet. `lagging` — An implementation of an earlier spec exists; it has not caught up with the current one. `alpha` — Implemented with tests. The API may still change. `beta` — Feature complete and at parity. Only fixes are expected. `stable` — Covered by semantic versioning. `deprecated` — Still shipped; scheduled for removal.

### Anatomy

- `container`: The round state layer behind the box (Material Design 3's 40). It carries hover, focus and press and is invisible at rest.
- `box`: The small square that shows the condition (Material Design 3's 18, with a 2 corner): empty with an outline when unchecked, filled when checked or indeterminate.
- `outline`: The border of the box, drawn inside its edge. The fill sits inside the border, so a translucent fill and border never overlap; where the two meet they are drawn as one shape, so nothing behind the box shows between them.
- `mark`: The glyph check (checked) or the glyph remove (indeterminate) of the system's icon set, centered on the box and drawn with the icon set's family, fill and optical size at the mark's own weight, comp.checkbox.mark.weight: in the default system heavier than the system's icons, because the mark is a thin stroke on a small filled box and is what tells checked from indeterminate. The checkbox draws no mark of its own; a system that wants another check chooses another icon set. The glyph is decorative: the condition is announced from the state.
- `label` (optional): The visible text that names the choice. A click on it toggles the checkbox.
- `focus-ring`: Gap-then-ring indicator shown for keyboard focus, following the box's shape.

### Props

| Prop | Type | Default | Web attribute | Description |
| --- | --- | --- | --- | --- |
| `checked` | `boolean` | `false` | `checked` | Whether the choice is on. |
| `indeterminate` | `boolean` | `false` | `indeterminate` | Shows the choice as partly on (a parent whose children are mixed). Wins over checked for what is drawn and announced; activation clears it. |
| `error` | `boolean` | `false` | `error` | Marks the choice as invalid (a required choice left unmade). Draws the error form of the condition and is exposed as invalid; the message itself belongs to the surrounding form. |
| `disabled` | `boolean` | `false` | `disabled` | Prevents interaction and removes the checkbox from the focus order. |
| `readOnly` | `boolean` | `false` | `readonly` | Shows the choice and keeps it: the checkbox can be focused and read and is submitted with its form, but the person cannot switch it. Drawn as an enabled checkbox, without the hover and press answers (CHK-24). |
| `label` | `string` | `""` | `label` | The text that names the choice: drawn next to the box and used as the accessible name. |
| `labelHidden` | `boolean` | `false` | `label-hidden` | Draws no visible label but keeps label as the accessible name (a row-selection checkbox in a table whose row already says what it is). |

### Events

| Event | Description |
| --- | --- |
| `change` | The user switched the checkbox; carries the new value of checked (indeterminate is then false). |

### States

`enabled`, `disabled`, `hovered`, `focused`, `pressed`, `selected`, `error`

### Accessibility

- Role: `checkbox`
- Labeling: label is the accessible name, visible or not (labelHidden). A click on the visible label toggles the checkbox, as a native label does. A checkbox with no label is reported in debug builds.
- Minimum target size: yes

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the checkbox. |
| Space | Switches it (an indeterminate checkbox becomes checked); nothing while it is read-only. |
| Enter | Nothing on the web (it submits the form); switches it where the platform activates any focused control with Enter (Android, tvOS). |

- The mixed state is announced as such (aria-checked="mixed" on the web, a toggleable state of Indeterminate on Android, a Semantics mixed value in Flutter, accessibilityState checked "mixed" in React Native). SwiftUI has no mixed trait on iOS: the value is announced as "mixed" through accessibilityValue.
- error is exposed as invalid (aria-invalid on the web, the error semantics on Android and Flutter). The reason is text the form shows and associates with the checkbox; the checkbox does not draw it.
- Read-only (CHK-24) is a checkbox that shows an answer in place and keeps it in the focus order, so that it is read with its form — on a review step, or where only some people may change it. HTML's readonly attribute does not apply to a checkbox, so a read-only checkbox is not a native one's: on the web it keeps the native checkbox enabled, cancels its activation and says read-only with aria-readonly, which WAI-ARIA allows on the checkbox role; React Aria's isReadOnly is the same: focusable, announced with its value, not changeable. Where the answer needs no control at all, write it as text; where the person may not reach it at all, it is disabled.
- Several checkboxes that answer one question are a checkbox group: it names the set, holds the list of the checked values under one name and says the set's error (CHK-23). A checkbox stands alone where it is one choice of its own — a consent, a setting — and in a field group where each checkbox of a set has a name of its own.
- The check and the dash are decorative glyphs of the icon set, hidden from assistive technology: where a glyph is written as a ligature (the web), its name ("check", "remove") is never announced or shown as text (CHK-12, CHK-19). Checked and indeterminate differ by the glyph alone, and both are exposed as states (CHK-14).
- The mark is drawn at its own weight (comp.checkbox.mark.weight, CHK-12), heavier than the system's icons in the default system. Its color already has the contrast of content on its fill; what a light weight loses is the stroke, which at this size is about one pixel wide and is drawn in a mix of the mark's color and the fill's. A system that sets a lighter weight should look at the dash in particular: it is one stroke, and it is all that tells indeterminate from checked.
- The selection motion is decoration too: under reduced motion the new condition is drawn whole at once, never later (CHK-17).
- The label wraps at 200% text size; the box does not grow with text, because it is a control, not text.
- How a state looks is a value decision of the active design system; components read the state's tokens and never compute the effect themselves.

### Behaviour

Requirements in EARS form, each with its stable id.

- **CHK-1** WHEN the user activates the checkbox by pointer, touch, Space, assistive technology or a click on its label THE checkbox SHALL switch checked and emit change exactly once with the new value; Enter SHALL activate it only on a platform whose convention activates any focused control with Enter (Android, tvOS), and SHALL NOT on the web, where Enter submits the form.
- **CHK-2** WHEN the user activates the checkbox while indeterminate is true THE checkbox SHALL set checked to true, clear indeterminate, and emit change with true.
- **CHK-3** WHILE disabled is true THE checkbox SHALL NOT change or emit change, SHALL NOT be focusable, SHALL ignore clicks on its label and SHALL expose the disabled state to assistive technology.
- **CHK-4** THE checkbox SHALL draw the condition its props select: indeterminate when indeterminate is true, otherwise selected when checked is true, otherwise unselected; and the error- form of that condition while error is true.
- **CHK-5** WHILE hovered, keyboard-focused or pressed THE checkbox SHALL render its container, box, mark, outline, label and opacity from the component tokens of its condition in the highest-precedence active state, with precedence pressed over focused over hovered; focus gained by pointer or touch SHALL NOT select the focused state. A part the interaction states recolor changes over the component's state motion, as the container does; only a change of condition uses the selection motion.
- **CHK-6** WHEN the checkbox receives keyboard focus THE checkbox SHALL show the focus ring around its box without animation; focus gained by pointer or touch SHALL NOT show it.
- **CHK-7** WHERE the visual size is below the minimum target THE checkbox SHALL extend its hit area on both axes to sys.target.touch for touch input and sys.target.pointer for fine pointers, without changing its visual size; a platform that cannot tell the input type SHALL use sys.target.touch. The visible label SHALL be part of the hit area as well.
- **CHK-8** WHILE disabled is true THE checkbox SHALL render its container, box, mark, outline, label and opacity from the disabled component tokens of its condition.
- **CHK-9** WHEN the checkbox is pressed by pointer, touch or Space, or by Enter where Enter activates it (Android, tvOS; never on the web, where Enter submits the form) THE checkbox SHALL show the pressed state without delay and SHALL keep it visible for at least sys.motion.duration.press-hold, even when the press ends sooner.
- **CHK-10** WHILE pressed THE checkbox SHALL answer as sys.behavior.pressed-feedback names: overlay applies the pressed tokens to the whole container at once; ripple grows the pressed state layer from the point of contact (from the center for keyboard activation; a press outside the container (on the label) grows it from the container's center); dim applies the pressed opacity to the whole control and draws no state layer; none draws no answer to the press. Under ripple and dim only the container color stays with the state under the press; box, mark, outline, label, opacity and shape still come from the pressed tokens. Under none every part stays with the state under the press. The ripple grows over comp.checkbox.motion.feedback-duration with motion.state-easing, fades over motion.state-duration with motion.state-easing once the press has ended and press-hold has passed, and appears whole where motion is reduced.
- **CHK-11** THE checkbox SHALL ease its container and box corners by sys.shape.corner-smoothing (0 is a quarter circle, 0.6 the iOS continuous corner; a platform with only the OS curve draws it for any amount above 0) and show its keyboard focus as sys.behavior.focus-style names (ring or glow); a platform that cannot draw a choice SHALL fall back to the first value and state that in its README.
- **CHK-12** THE checkbox SHALL draw a box of side comp.checkbox.box.size with corners comp.checkbox.box.shape, centered in a round container of diameter comp.checkbox.container.size; its outline of width comp.checkbox.outline.width SHALL lie inside the box's edge and its fill inside the outline, never under it. Its mark SHALL be a glyph of the system's icon set, check while selected and remove while indeterminate, and SHALL NOT be drawn while unselected: centered on the box at comp.checkbox.mark.size, with sys.icon.family.selected, sys.icon.fill.selected, the weight comp.checkbox.mark.weight (not sys.icon.weight) and an optical size clamped between sys.icon.optical-size.min and sys.icon.optical-size.max, not clipped by the box, and hidden from assistive technology. THE checkbox SHALL draw no mark of its own (no path, shape or character of its own for the check or the dash). The weight SHALL change the stroke of the glyph only: the glyph box stays comp.checkbox.mark.size, and the box, the container and the place of the glyph are the same at every weight.
- **CHK-13** WHEN the condition changes after the checkbox was first drawn THE checkbox SHALL change the box, outline and mark colors over comp.checkbox.motion.selection-duration with comp.checkbox.motion.selection-easing; a glyph that appears SHALL fade in over the same duration and curve while growing about the box's center from comp.checkbox.motion.mark-enter-scale of its size to its full size over comp.checkbox.motion.mark-scale-duration with comp.checkbox.motion.mark-scale-easing, and a glyph that goes SHALL fade out and shrink to comp.checkbox.motion.mark-enter-scale the same way; between checked and indeterminate the check goes and the dash appears at the same time. A change of error alone SHALL only recolor, and the box and container SHALL NOT change size or move.
- **CHK-14** THE checkbox SHALL expose the role checkbox with the state checked, not checked or mixed (mixed while indeterminate is true), and SHALL expose the invalid state while error is true.
- **CHK-15** WHILE label is not empty and labelHidden is false THE checkbox SHALL draw label at the inline end of the container, comp.checkbox.label.gap away, in comp.checkbox.label.typescale, wrapping rather than truncating, the control centered on the label's first line; right-to-left layouts SHALL mirror the order.
- **CHK-16** WHILE labelHidden is true THE checkbox SHALL draw no label and SHALL still expose label as its accessible name; WHILE label is not empty, or a Field that frames it gives it a label, THE checkbox SHALL expose that label as its accessible name, over a name the product gives it on the element (aria-label or aria-labelledby); WHILE label is empty and the product gives the checkbox a name of its own on the element — aria-label, or aria-labelledby naming an element — THE checkbox SHALL expose that name as its accessible name; WHILE label is empty and the product gives it none THE checkbox SHALL still render, and in debug builds report that it has no accessible name.
- **CHK-17** WHERE motion is reduced THE checkbox SHALL draw the new condition whole in the first frame after the change: the box, outline and mark colors of the new condition, the new glyph at its full size and full opacity, and the old glyph gone, with no frame in between; a change that arrives while a selection motion is running SHALL end that motion in the same frame. The change SHALL be neither delayed nor skipped.
- **CHK-18** WHEN the condition changes again before the selection motion of CHK-13 has ended THE checkbox SHALL move from what it draws at that moment to the latest condition, never first jumping to the end of the earlier change, and SHALL end on the latest condition's colors and glyph alone.
- **CHK-19** IF the icon set cannot draw the glyph yet (its font is still loading or failed to load) THE checkbox SHALL draw nothing in the glyph's place, never the glyph's name as text, SHALL still draw the box, its fill and its outline and expose its state, and SHALL show the glyph once the icon set can draw it, without the selection motion.
- **CHK-20** THE checkbox SHALL take its layout direction from where it is used — the direction of the nearest ancestor that sets one, and the platform's own where none does — and SHALL have no direction setting of its own; WHEN that direction changes while the checkbox is shown THE checkbox SHALL draw itself for the new direction at once, without a motion of its own, keeping its selection and its focus.
- **CHK-21** THE checkbox SHALL lay out its label as text of its own direction, isolated from the text around it: each takes the base direction of its first strong character, or the layout direction where it has none, so that a left-to-right word, a number with its sign or unit, a telephone number and an address keep their own order in a right-to-left layout and reorder nothing beside them; THE checkbox SHALL still place the label and align its lines by the layout direction, not by the text's own.
- **CHK-22** THE checkbox SHALL draw the outline and the fill of its box as one shape: every point inside the box's outer edge SHALL be painted by the outline, by the fill, or, along the line where the two meet, by both in shares that add up to the whole, so that nothing behind the box shows between them at any zoom, display density or fractional position, in any frame of the selection motion (CHK-13), and so that a box whose outline and fill have the same color is that one color, evenly, from its edge to its mark; the two SHALL NOT be painted over one another either (CHK-12), so that a translucent outline or fill is nowhere darker than its token.
- **CHK-23** WHILE the checkbox stands in a checkbox group THE checkbox SHALL take its checked from the group's value and from the value the group reads from it (CKG-2), SHALL be disabled WHILE the group is (CKG-6), SHALL have its switching by the person reported by the group's change and by no event of its own that a listener on the group would receive as well (CKG-4), and WHERE the platform has forms SHALL submit nothing of its own, whatever name it carries (CKG-8). WHERE the checkbox stands in no checkbox group it SHALL be as it is anywhere — in a field, in a field group, in a table's row or alone: checked is its own, change is its own, and on the web it submits its own entry under its own name.
- **CHK-24** WHILE readOnly is true and disabled is false THE checkbox SHALL stay focusable and in the focus order; SHALL NOT change checked or indeterminate, and SHALL NOT emit change, on any activation — pointer, touch, Space, Enter where Enter activates it, assistive technology, a click on its label or a click dispatched on the element; SHALL expose the read-only state to assistive technology beside its checked, not checked or mixed state; WHERE the platform has forms SHALL be submitted with its form as it is drawn, and SHALL NOT report a missing value to the form's own validation, because the person cannot give one; and SHALL be drawn from the resting component tokens of its condition — the enabled ones, never the disabled ones — and SHALL show no hovered and no pressed state, under any pressed feedback (no overlay, no ripple, no dim), while keyboard focus still selects the focused state and shows the focus ring (CHK-5, CHK-6). The product may still set checked and indeterminate, which then take the selection motion (CHK-13). WHILE disabled is true as well, disabled wins (CHK-3).
- **CHK-25** WHERE the platform has ARIA attributes (the web), WHEN the product sets an aria- attribute on the host, by the attribute or by the ARIA property that reflects it, THE checkbox SHALL move it to the data-aria- attribute of the same name, so that the host is no second node with its name, description or state, and SHALL expose it on the element that carries its role — an id reference by the elements it names in the host's tree or a tree around it, an error message as part of the description while the checkbox is invalid — except those the checkbox owns (aria-checked, aria-pressed, aria-disabled), which it SHALL move and not expose. WHEN the product removes the aria- attribute or its data-aria- twin, or sets the ARIA property that reflects it (ariaLabel, ariaDescribedByElements…) to null, THE checkbox SHALL take it off that element. WHEN the product sets an aria- attribute the checkbox owns THE checkbox SHALL report it in debug builds.

### Tokens

As written in the token documents (DTCG): an alias in braces names the token it takes its value from, which each design system resolves. On the web each token is a CSS custom property: `--tanrei` and the name after `tanrei`, joined by hyphens (`tanrei.comp.checkbox.…` → `--tanrei-comp-checkbox-…`).

#### `tanrei.comp.checkbox`

| Token | Type | Value |
| --- | --- | --- |
| `comp.checkbox.container.shape` | `dimension` | `{tanrei.sys.shape.corner.full}` |
| `comp.checkbox.container.size` | `dimension` | `40px` |
| `comp.checkbox.box.size` | `dimension` | `18px` |
| `comp.checkbox.box.shape` | `dimension` | `2px` |
| `comp.checkbox.outline.width` | `dimension` | `{tanrei.sys.border.thick}` |
| `comp.checkbox.mark.size` | `dimension` | `{tanrei.sys.icon.small}` |
| `comp.checkbox.mark.weight` | `number` | `{tanrei.sys.icon.mark.weight}` |
| `comp.checkbox.label.typescale` | `typography` | `{tanrei.sys.typescale.body}` |
| `comp.checkbox.label.gap` | `dimension` | `{tanrei.sys.space.space50}` |
| `comp.checkbox.unselected.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.unselected.box.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.unselected.mark.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.unselected.outline.color` | `color` | `{tanrei.sys.color.outline}` |
| `comp.checkbox.unselected.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.unselected.state-layer.color` | `color` | `{tanrei.comp.checkbox.unselected.outline.color}` |
| `comp.checkbox.selected.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.selected.box.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.checkbox.selected.mark.color` | `color` | `{tanrei.sys.color.on-primary}` |
| `comp.checkbox.selected.outline.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.checkbox.selected.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.selected.state-layer.color` | `color` | `{tanrei.comp.checkbox.selected.outline.color}` |
| `comp.checkbox.indeterminate.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.indeterminate.box.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.checkbox.indeterminate.mark.color` | `color` | `{tanrei.sys.color.on-primary}` |
| `comp.checkbox.indeterminate.outline.color` | `color` | `{tanrei.sys.color.primary}` |
| `comp.checkbox.indeterminate.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.indeterminate.state-layer.color` | `color` | `{tanrei.comp.checkbox.indeterminate.outline.color}` |
| `comp.checkbox.error-unselected.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.error-unselected.box.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.error-unselected.mark.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.error-unselected.outline.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.checkbox.error-unselected.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.error-unselected.state-layer.color` | `color` | `{tanrei.comp.checkbox.error-unselected.outline.color}` |
| `comp.checkbox.error-selected.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.error-selected.box.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.checkbox.error-selected.mark.color` | `color` | `{tanrei.sys.color.on-error}` |
| `comp.checkbox.error-selected.outline.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.checkbox.error-selected.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.error-selected.state-layer.color` | `color` | `{tanrei.comp.checkbox.error-selected.outline.color}` |
| `comp.checkbox.error-indeterminate.container.color` | `color` | `{"colorSpace":"srgb","components":[0,0,0],"alpha":0,"hex":"#000000"}` |
| `comp.checkbox.error-indeterminate.box.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.checkbox.error-indeterminate.mark.color` | `color` | `{tanrei.sys.color.on-error}` |
| `comp.checkbox.error-indeterminate.outline.color` | `color` | `{tanrei.sys.color.error}` |
| `comp.checkbox.error-indeterminate.label.color` | `color` | `{tanrei.sys.color.on-surface}` |
| `comp.checkbox.error-indeterminate.state-layer.color` | `color` | `{tanrei.comp.checkbox.error-indeterminate.outline.color}` |
| `comp.checkbox.motion.state-duration` | `duration` | `{tanrei.sys.motion.role.state.compact}` |
| `comp.checkbox.motion.state-easing` | `cubicBezier` | `{tanrei.sys.motion.easing.state}` |
| `comp.checkbox.motion.feedback-duration` | `duration` | `{tanrei.sys.motion.role.feedback}` |
| `comp.checkbox.motion.selection-duration` | `duration` | `{tanrei.sys.motion.role.selection.mark}` |
| `comp.checkbox.motion.selection-easing` | `cubicBezier` | `{tanrei.sys.motion.easing.state}` |
| `comp.checkbox.motion.mark-scale-duration` | `duration` | `{tanrei.sys.motion.role.selection.mark}` |
| `comp.checkbox.motion.mark-scale-easing` | `cubicBezier` | `{tanrei.sys.motion.easing.spatial}` |
| `comp.checkbox.motion.mark-enter-scale` | `number` | `0.5` |

Per-state tokens, valued by the design system's pattern rules (not written by hand):

- `comp.checkbox.<variant>.<state>.<property>` for the variants `unselected`, `selected`, `indeterminate`, `error-unselected`, `error-selected`, `error-indeterminate`, the states `hovered`, `focused`, `pressed`, `disabled` and the properties `container.color`, `box.color`, `mark.color`, `outline.color`, `label.color`, `state-layer.color`.
- `comp.checkbox.<state>.<property>` for the states `hovered`, `focused`, `pressed`, `disabled` and the properties `opacity`, `container.shape`.

## Guidelines

### When to use

Use a checkbox for a choice that stands on its own: a list where people may pick any number of options, including none, or a single yes-or-no such as agreeing to terms. The choice takes effect when the person confirms, for example by submitting the form or saving. A checkbox also selects rows in a table or items in a list.

The indeterminate state belongs to a parent checkbox whose children are partly checked, such as “Select all” above a list. It is not a third answer that a person can pick.

### Read-only

A read-only checkbox shows an answer that the person can read but not change, such as a review step before an order is sent, or a setting that only some people may change. It stays in the focus order, is announced with its state and as read-only, and is submitted with its form. It looks like an enabled checkbox without the hover and press feedback, so that it reads as an answer rather than as something unavailable. Use `disabled` when the choice does not apply at all, and write the answer as text when nobody needs to reach it.

### Checkbox, radio button or switch

| Control | Choices | Takes effect | Use for |
| --- | --- | --- | --- |
| Checkbox | Any number of independent choices, including none | When the person confirms | Options in a form, agreeing to terms, selecting rows |
| [Radio button](https://tanrei.chnotchy.com/components/radio-button/) | Exactly one from a small group, all shown | When the person confirms, usually | One answer to one question |
| [Switch](https://tanrei.chnotchy.com/components/switch/) | One setting, on or off | At once | Settings that apply as soon as they change |

### Do

- Write the label as the choice, stated positively: “Email me updates”, not “Don’t email me”.
- Stack a list of checkboxes vertically, one per line, so each label starts in the same place.
- Derive the indeterminate state from the children. When the parent is activated, check every child.
- When a required checkbox is left unchecked, set `error` and say why in the form’s message.

### Don’t

- Don’t use a checkbox for a change that applies at once. Use a switch.
- Don’t use checkboxes for choices that exclude each other. Use radio buttons.
- Don’t put links or other controls inside the label. A click on the label toggles the checkbox.
- Don’t hide the label unless the row around the checkbox already says what it selects.

## Accessibility

### What the component handles

- It exposes the checkbox role with its state (checked, not checked, or mixed while indeterminate), its disabled state, and the invalid state while `error` is set. React Native has no invalid state, so there an error is drawn but not announced.
- The label is the accessible name, whether it is drawn or hidden with `labelHidden`. The drawn text is hidden from assistive technology, so the name is read once.
- A click or tap on the label toggles the checkbox. The label is part of the hit area, and the hit area meets the minimum target.
- Space toggles it. Enter toggles it only where the platform activates any focused control with Enter (Android, tvOS); on the web, Enter submits the form.
- While `readOnly` is set it stays focusable and is announced as read-only beside its state. No press, Space, click on the label or `click()` changes it, and it shows no hover or press feedback. On the web its value is still submitted, and a required one reports no missing value. HTML’s `readonly` does not apply to a checkbox, so the component does this itself.
- It shows the focus indicator around the box, for keyboard focus only.
- The check and the dash are hidden from assistive technology. Checked and mixed are announced from the state, never from the glyph’s name.
- Where motion is reduced, the new condition is drawn whole in the first frame after the change, never delayed or half-drawn. A change during a change continues from what is drawn at that moment.
- While the icon font cannot draw the glyph yet, the checkbox draws nothing in its place, never the word “check”, and still draws its filled box and exposes its state. The glyph appears once the font has loaded.
- On the web it takes part in a form like a native checkbox: `name`, `value`, `required` and reset.
- A missing label is reported in debug builds.

Known platform gaps:

- SwiftUI, Compose, Flutter and React Native still draw the check and the dash as marks of their own and animate them in their own way, without the mark’s own weight and the one-shape box.
- `readOnly` is on the web only so far: SwiftUI, Compose, Flutter and React Native do not have it yet.
- Under `m3-like`, the check is the icon set’s glyph and fades and grows in, where Material draws its own check on stroke by stroke and bends it into the dash (mimicry gap `checkbox-mark-drawn-on`).

### What you need to do

- Load the icon font. Until it has loaded, a checked and an indeterminate checkbox look the same: both are filled boxes with no glyph. Their states are still announced.
- If your design system sets a lighter weight for the mark (`comp.checkbox.mark.weight`), look at the dash: it is a single stroke, and it is all that tells indeterminate from checked by sight.
- Write a label that names the choice, and keep it the same whether the checkbox is checked or not. The platform announces the state.
- When `error` is set, show the reason as text next to the checkbox or in the form’s summary, and associate it with the checkbox. The checkbox says that it is invalid, not why. On React Native, the message is the only way the error is heard.
- Give a group of checkboxes that answer one question a name: on the web, a `<fieldset>` with a `<legend>`.
