Checkbox
Selects one or more options, alone or in a labelled group, with indeterminate and invalid states.
Preview
Installation
pnpm add @syntara/react @syntara/tokensimport { Checkbox, CheckboxGroup } from '@syntara/react';Usage
import { Checkbox, CheckboxGroup } from '@syntara/react';
export function Channels() {
return (
<CheckboxGroup label="Notify me by" defaultValue={['email']}>
<Checkbox value="email">Email</Checkbox>
<Checkbox value="sms">SMS</Checkbox>
</CheckboxGroup>
);
}Examples
Group
Horizontal group
Indeterminate
A "select all" parent for a set of options.
Invalid and disabled
Accessibility
| Keys | Action |
|---|---|
| Space | Toggles the focused checkbox. |
| Tab | Moves between checkboxes. |
- Uses a native checkbox input, so forms and assistive tech work without extra ARIA.
- Each row is at least 24px tall and the whole label is clickable (WCAG 2.5.8).
- Descriptions are linked with aria-describedby and stay out of the accessible name.
- Invalid state shows a danger border plus an error message with an icon.
Guidelines
Do
- Use for independent on/off choices or picking several items from a list.
- Write labels as positive statements: "Email me about updates".
- Use a group label that names the question.
Don’t
- Don't use a checkbox for settings that apply immediately; use a Switch.
- Don't use checkboxes for mutually exclusive options; use RadioGroup.
API reference
Checkbox
childrenReactNodeThe label. Without one, pass aria-label.
descriptionReactNodeHelp text under the label, linked with aria-describedby.
valuestringValue inside a CheckboxGroup.
isSelected / defaultSelectedbooleanControlled / uncontrolled state (standalone).
onChange(isSelected: boolean) => voidCalled when toggled.
isIndeterminatebooleanShows a dash, e.g. for a partially selected "select all".
Default
falseerrorMessagestring | ((validation: ValidationResult) => string)Standalone only (e.g. accepting terms with isRequired). In a group, the group shows errors.
isRequired / isInvalid / isDisabledbooleanValidation and disabled state.
Default
false
CheckboxGroup
labelReactNodeGroup label. Without one, pass aria-label.
descriptionReactNodeHelp text under the group label.
errorMessagestring | ((validation: ValidationResult) => string)Shown with an icon when the group is invalid.
value / defaultValuestring[]Controlled / uncontrolled selected values.
onChange(value: string[]) => voidCalled when the selection changes.
orientationhorizontalverticaldefault
Stack options, or lay them out in a wrapping row.
isRequired / isInvalid / isDisabledbooleanValidation and disabled state for the whole group.
Default
false
Tokens
The semantic tokens this component reads, grouped by what they control. Swatches show this site’s theme; change a tenant’s brand and the component follows with no code change.
- Colour13
action.primary.bgaction.primary.fgaction.primary.hoverborder.defaultborder.strongfeedback.danger.onSolidfeedback.danger.solidfocus.ringsurface.defaultsurface.sunkentext.defaulttext.disabledtext.subtle- Type2
font.size.mdline-height.normal- Space and size5
control-heightspace.1space.2space.5space.6- Shape1
radius.field- Depth2
shadow.highlightshadow.raised- Motion6
motion.duration.fastmotion.duration.normalmotion.duration.springmotion.easingmotion.easingOutmotion.spring