Checkbox
Checkbox is a form control for single and multiple selections.
It's unlikely that you'll be rendering a single Checkbox. See the CheckboxGroup component for rendering a set of Checkboxes.
Best practices
- An individual Checkbox should not have its own validation message or style. Instead, show a validation message on the CheckboxGroup. For more information, see the Validation Message section in the Forms documentation.
- While there are certain use cases where an individual checkbox may be required, the most common use case is to require a selection from a CheckboxGroup. In this case, an individual checkbox button should not be marked as required, but the checkbox group should be marked as required instead. For more information, see the Required field indicator in the Forms documentation.
React examples
Default
With a caption
This is a caption
With a leading visual
In a group of Checkboxes
This example uses the CheckboxGroup component to render a set of Checkboxes.
Indeterminate
More code examples
See the Checkbox Storybook stories
Props
Loading data for checkbox...