Skip to content
GitHub (opens in a new tab)

Checkbox

Multi-select or confirmation control. Optional visible label.

stableAtomcontracts/checkbox.json

Preview

Checkboxes

Multi-select and confirmations. Each in lg, md, and sm. Label optional.

Master

A medium labeled Checkbox. Click it to check it. Variants shows sizes, unlabeled and every state.

Usage

RadioGroup for exclusive choice. Unlabeled needs ariaLabel. Indeterminate only for a parent that reflects mixed children.

Do's

  • Independent booleans such as agree to terms or enable notifications
  • Confirmations that are not a submit action
  • Table row or icon-only select without visible text — set ariaLabel

Don'ts

  • Choosing one of several options — use RadioGroup
  • Primary form submit actions — use Button
  • Immediate on/off setting — use Switch
<Checkbox
  id="updates"
  size="md"
  label="Send me product updates"
  checked={false}
  onChange={() => {}}
/>

When to use

  • Independent booleans such as agree to terms or enable notifications
  • Confirmations that are not a submit action
  • Table row or icon-only select without visible text — set ariaLabel

When not to use

  • Choosing one of several options — use RadioGroup
  • Primary form submit actions — use Button
  • Immediate on/off setting — use Switch

What an agent reads

import { Checkbox } from "agentic-ds-kit";
must
  • Visible label via label/htmlFor OR aria-label when no text
  • Disabled state is exposed
  • Error described if used with Field
  • Indeterminate is aria-checked=mixed
  • Do not ship unlabeled without ariaLabel
defaults
  • size md
  • disabled false
  • error false
  • defaultChecked false
  • indeterminate false
stops if
  • Do not invent local Checkbox
  • Do not use raw hex
  • Do not use RadioGroup for booleans
  • Do not ship unlabeled without ariaLabel
  • Do not use Switch as a checkbox

From contracts/checkbox.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
idstringYes——
labelstringNo—visible text; required unless ariaLabel is set
ariaLabelstringNo—required when label is omitted (table row, icon-only slot)
sizelg | md | smNomd—
disabledbooleanNofalse—
errorbooleanNofalse—
checkedbooleanNo—controlled
defaultCheckedbooleanNofalseuncontrolled
indeterminatebooleanNofalsevisual + aria-checked mixed; set via input.indeterminate
onChangefunctionNo—(checked: boolean) => void
namestringNo——
describedBystringNo—Field wires hint and error ids onto the input
  • Component
    →

    RadioGroup

    Choose exactly one option from a small visible set.

  • Component
    →

    Button

    Clickable action control with appearance × mode (plus an optional flat set) and a fixed set of sizes.

  • Component
    →

    Switch

    Immediate on/off setting.