Inputs · Checkboxstable
Checkbox
Lets people pick any number of options from a list, or confirm a single choice such as accepting terms. Three values (unchecked, checked, indeterminate), three sizes, help and error text, plus CheckboxGroup for related options.
Preview
#previewSwitch size, value and state. Show code opens the React and CSS below.
size medium · checked · default
digest-option.tsx
import { Checkbox } from "@blade-ai/weft/components/checkbox";
export function DigestOption({ isChecked, onChange }: Props) {
return (
<Checkbox
label="Email me Blade AI product updates"
helpText="You can unsubscribe at any time."
isChecked={isChecked}
onChange={({ isChecked }) => onChange(isChecked)}
/>
);
}All states
#all-statesEvery state from the Checkbox spec, named. Medium unless noted.
Unchecked
Checked
Indeterminate
Hover · unchecked
Hover · checked
Focus-visible
Pressed · unchecked
Pressed · checked
Disabled
Disabled · checked
Read-only
Read-only · checked
Invalid
With help text
Small
Large
Group · vertical
Group · horizontal
Props
#propsBooleans are is-prefixed. One of label or accessibilityLabel is required. Anything marked UNDEFINED is an open decision.
Prop
Type
Default
Description
Checkbox.label
string
—
Visible text next to the box. Rendered inside the <label>; clicking it toggles the box. One of label or accessibilityLabel is required.
Checkbox.accessibilityLabel
string
—
Accessible name when there is no visible label (table rows). Becomes aria-label.
Checkbox.isChecked
boolean
—
Controlled checked value. Use with onChange; the component never changes its own state when set.
Checkbox.isDefaultChecked
boolean
false
Initial value when uncontrolled. Ignored if isChecked is set.
Checkbox.isIndeterminate
boolean
false
Shows the dash and exposes the mixed state. Overrides the checked look; the app clears it when the children change.
Checkbox.onChange
({ isChecked: boolean; value?: string; event }) => void
—
Fires on every toggle (click, label click, Space). Not fired when disabled or read-only. Required when controlled.
Checkbox.name
string
—
Form field name. Inside CheckboxGroup it comes from the group.
Checkbox.value
string
"on"
Value sent with the form when checked. Required inside CheckboxGroup.
Checkbox.size
"small" | "medium" | "large"
"medium"
Box 14 / 16 / 20px with label 12 / 14 / 16. Inside CheckboxGroup it comes from the group.
Checkbox.helpText
string
—
Hint under the label, linked with aria-describedby.
Checkbox.errorText
string
—
Shown when validationState is "error"; replaces helpText in the same slot. Required when validationState="error".
Checkbox.validationState
"none" | "error"
"none"
"error" draws the negative border and sets aria-invalid.
Checkbox.isDisabled
boolean
false
Native disabled: not focusable, not submitted, 50% opacity.
Checkbox.isReadOnly
boolean
false
Focusable and submitted, but the value cannot change. Sets aria-readonly. Visual treatment is UNDEFINED (gray fill proposed).
Checkbox.isRequired
boolean
false
Must be checked to submit. Sets required. Visible required marker: UNDEFINED.
Checkbox.autoFocus
boolean
false
Focuses the checkbox input itself on mount (not the label or group).
Checkbox.testID
string
—
Test selector on the input (data-testid).
CheckboxGroup.label *
string
—
Legend text that names the group. Rendered as <legend>.
CheckboxGroup.value
string[]
—
Checked values, controlled. Required with onChange when controlled.
CheckboxGroup.defaultValue
string[]
"[]"
Initial checked values when uncontrolled.
CheckboxGroup.onChange
({ values: string[]; name?: string; event }) => void
—
Fires with the new list after any child toggles.
CheckboxGroup.orientation
"vertical" | "horizontal"
"vertical"
Stack (gap spacing-4) or row for 2-3 short options (gap spacing-7).
CheckboxGroup.name
string
—
Form field name passed to every child. Required for forms.
CheckboxGroup.size
"small" | "medium" | "large"
"medium"
Passed to every child Checkbox.
CheckboxGroup.helpText
string
—
Hint under the group, linked to the fieldset with aria-describedby.
CheckboxGroup.errorText
string
—
Shown once under the group when validationState is "error"; replaces helpText.
CheckboxGroup.validationState
"none" | "error"
"none"
"error" gives every child the error border and aria-invalid.
CheckboxGroup.isDisabled
boolean
false
Disables every child.
CheckboxGroup.isRequired
boolean
false
At least one must be checked; the app validates. Visible marker: UNDEFINED.
Usage
#usageShort rules for choosing and writing checkboxes.
Do
Use a native <input type="checkbox"> and a real <label>; keep the input in the accessibility tree.
Keep the 1px interactive/border/primary/default outline on checked and indeterminate boxes.
Use only the Theme tokens listed under States; Global tokens only for size, spacing, radius, type.
Wrap related options in CheckboxGroup (fieldset + legend) and show one group error.
Write positive, sentence-case labels without end punctuation, e.g. "Email me Blade AI product updates".
Clear the error as soon as the value becomes valid.
Don't
Don't add component tokens (no checkbox/*); add a Theme token or flag UNDEFINED.
Don't round the box: Weft uses --border-radius-none.
Don't show the focus ring on mouse click; use :focus-visible.
Don't toggle on Enter, and don't add arrow-key navigation.
Don't use indeterminate on a lone checkbox, or a checkbox for an instant setting (use Switch).
Don't hide the input with display:none or visibility:hidden.
Accessibility
#accessibilityNative input type checkbox inside a real label. Space toggles, Enter never does.
Keyboard
Key
Action
Tab / Shift+Tab
Next / previous checkbox; each is a tab stop; disabled skipped, read-only kept.
Space
Toggle (unchecked <-> checked; indeterminate -> checked). No-op when read-only or disabled.
Enter
No toggle; submits the form (native).
Arrow keys
No effect.
Click label
Toggle + focus the input; no ring (not :focus-visible).
ARIA
Element
Role / attribute
When
input
type="checkbox"
Always
input
checked
isChecked
input
indeterminate (DOM property)
isIndeterminate; exposed as aria-checked="mixed"
input
aria-label
accessibilityLabel, only when there is no label
input
aria-describedby
id of helpText, or of errorText when invalid
input
aria-invalid="true"
validationState = "error"
input
aria-readonly="true"
isReadOnly
input
required
isRequired
input
disabled
isDisabled
fieldset
aria-describedby
id of group helpText / errorText
legend
text
CheckboxGroup label
select-all input
aria-controls
space-separated ids of the child inputs (set by the app)
Agent Spec
#agent-specMachine-readable spec, tables (a)–(h). Same source as /specs/checkbox.json. Anything marked UNDEFINED needs a decision before it is built.
[ "Pressed fill for a checked box (--undefined-interactive-background-primary-pressed; falls back to the highlighted fill)", "Read-only visual treatment (gray fill proposed, not approved)", "When the error first shows: on submit (fallback) or on change", "Visible required marker (fallback: none; say it in the label)", "Check / dash motion (fallback: instant)" ]