Checkbox
Lets users select one or more options from a set.
- Status
- ReadyBuild day 1 of 21
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Accept the terms to continue.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { Checkbox } from "@/ui";
export default function CheckboxDemo() {
const [agreed, setAgreed] = useState<boolean>(false);
return (
<Checkbox
size="md"
label="I agree to the terms"
checked={agreed}
onChange={(e) => setAgreed(e.target.checked)}
error={agreed ? undefined : "Accept the terms to continue."}
/>
);
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Accept the terms to continue.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required visible label, connected to the checkbox.
- hint
- string · default none
- Helper text under the label.
- error
- string · default none
- Marks the checkbox invalid, sets aria-invalid, and replaces the hint.
- size
- "sm" | "md" | "lg" · default "sm"
- Control and text size: 16px, 20px, or 24px box.
- indeterminate
- boolean · default false
- Partly selected. Only for a parent row whose children are partly selected. It is not a value users can pick.
- className
- string · default ""
- Extra classes for the wrapper.
- ...rest
- InputHTMLAttributes · default none
- Every other native input attribute, such as checked, defaultChecked, onChange, disabled, name, and required. Not id or type.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 💡 Selection
- checked, indeterminate
- Unchecked and Checked are the native checked state. Indeterminate is the indeterminate prop.
- 📐 Size
- size
- sm, md, or lg.
- 🎯 State
- error, disabled
- Error is the error prop and disabled is the native attribute. Hover and focus come from the browser at runtime.
- Show Label
- None
- No prop. The label is always shown, because a checkbox without a label has no name.
- Helper Text
- hint, error
- hint is the help line. error replaces it while it is set.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- A native checkbox: Tab focuses it and Space toggles it.
- A disabled checkbox uses the native disabled attribute, so Tab skips it.
- The component draws its own focus ring: 2px in the border/focus role.
Screen readers
- The label is linked with for and a generated id, so it is the accessible name. Clicking the label toggles the checkbox.
- The hint, or the error when there is one, is linked with aria-describedby and read after the name.
- indeterminate is set on the DOM element, so it is announced as mixed.
- error sets aria-invalid="true". The error line is not a live region, so it is read when the checkbox gets focus.
What you still need to do
- Use indeterminate only for a parent whose children are partly selected, and update it from the children.
- Group related checkboxes in a fieldset with a legend.
- On submit, move focus to the first invalid checkbox, because a new error is not announced.
When to use
Multi-select choices and binary settings.
Do and don't
Do
- Group related checkboxes with a clear label.
- Support an indeterminate state for partial selection.
Don't
- Use checkboxes for mutually exclusive options: use radio buttons instead.
- Hide the selection state visually.
Related
4 of 16 other atoms, same role and ready ones first.
- OTP InputBoxes for entering a one-time code sent by SMS or email.Ready
- PIN InputMasked boxes for entering a secret PIN.Ready
- Radio ButtonA single option that belongs to a set where only one can be chosen.Ready
- SliderPicks a value from a continuous range by dragging.Ready
Status reflects the component tracker snapshot of 29 October 2026.