- Implementation
- Checkbox Props
- Checkbox.Group Props
Common Examples
Basic checkbox inputs
TheCheckbox component accepts many of the same props as an HTML input with type="checkbox", such as name, value, checked, and defaultChecked.Controlling checkbox state
Use thechecked and onClick props to manually control the state of a checkbox.Indeterminate checkboxes
Theindeterminate prop should be used to represent a checkbox that has checkbox children which some, but not all are checked.React Accessibility
- The
Checkboxcomponent’slabelprop allows for anyReactElementto be passed in, but thelabelshould always be populated with some text content that is screen-reader accessible.
Markdown in legends
TheCheckbox.Group legend prop supports inline markdown: bold (**text**), italic (*text*), bold and italic (***text***), highlight (==text==), and code (`text`).Hide the legend
UsehideLabel on Checkbox.Group to visually hide the legend. The legend string is kept as a screen-reader-only <legend> element so the group remains accessible — any inline markdown is stripped to plain text.