Swarm Design System Documentation
Checkbox
A checkbox allows a user to select a value from a small set of options, often binary.
Example
Snippets
<> <Checkbox label="do this thing" checked={true === true} /> <Checkbox label="also this thing" checked={true === false} /> </>
Props
Name | Type | Required? | Default | Description |
---|---|---|---|---|
checked | boolean | required | none | Whether the box should be checked. |
disabled | boolean | optional | none | Whether the box should be interactive. |
id | string | optional | none | An identifier for the checkbox. |
onChange | signature | optional | none | A callback function that is called when the checkbox is toggled. |
children | ReactReactNode | optional | none | Child nodes that would be placed if there is no label. |
label | string | optional | none | A label for your checkbox input. It will not be shown if `children` are passed to the component. |
name | string | optional | none | Name for checkbox form field. |
value | union | optional | none | Value for checkbox form field. |
a11y
Keyboard interactions: Space should activate the checkbox.