Checkbox / CheckboxGroup
Two components: Checkbox for a standalone toggle, and CheckboxGroup for a labelled
set of related checkboxes. Both wrap the corresponding React Aria primitives.
Add via CLI
Section titled “Add via CLI”npx @a2ra/cli add checkboxStandalone
Section titled “Standalone”Example JSON
Section titled “Example JSON”{ "type": "CheckboxGroup", "props": { "label": "Interests", "name": "interests", "orientation": "horizontal" }, "children": [ { "type": "Checkbox", "props": { "label": "Design", "value": "design" } }, { "type": "Checkbox", "props": { "label": "Engineering", "value": "eng" } } ]}Checkbox props
Section titled “Checkbox props”| Prop | Type | Description |
|---|---|---|
label | string | Visible label text |
value | string | Value submitted with the form |
name | string | Form field name |
isSelected | boolean | Controlled checked state |
defaultSelected | truefalse default | Uncontrolled default |
isDisabled | truefalse default | Disables the checkbox |
isRequired | truefalse default | Marks as required |
isIndeterminate | truefalse default | Shows indeterminate state |
isReadOnly | truefalse default | Prevents toggling |
isInvalid | truefalse default | Shows error styling |
validationBehavior | aria defaultnative | Validation strategy |
errorMessage | string | Error text when isInvalid is true |
CheckboxGroup props
Section titled “CheckboxGroup props”| Prop | Type | Description |
|---|---|---|
label | string | Group label |
value | string[] | Controlled selected values |
defaultValue | string[] | Uncontrolled default |
isDisabled | truefalse default | Disables all checkboxes |
isRequired | truefalse default | Marks group as required |
isReadOnly | truefalse default | Prevents any changes |
isInvalid | truefalse default | Shows error styling on the group |
validationBehavior | aria defaultnative | Validation strategy |
orientation | horizontalvertical default | Layout direction |
name | string | Form field name |
description | string | Helper text |
errorMessage | string | Error text when isInvalid is true |
children | node[] | Checkbox child nodes |
CheckboxGroupmanages keyboard navigation and ARIA group labelling automatically.isIndeterminateis a visual-only state; it does not affect the submitted form value.