Form
Checkbox input
Published on
Description
Checkboxes allow users to select one or more options from a list, or toggle a single option on/off. Group related checkboxes inside a <fieldset> with a <legend>.
Example
Related options can be organized into groups using nested <fieldset> elements that share the same name.
Accessibility
- Use
<fieldset>and<legend>to group related checkboxes. The legend provides context announced by screen readers before each option. - Visually hide checkbox inputs using clip/position methods — never
display: none. Use::before/::afterpseudo-elements for custom indicators. - Support Windows High Contrast Mode, dark mode,
prefers-reduced-motion, RTL, and print. - Consider
accent-colorfor simple brand customization of native checkboxes.
References
- Under-Engineered Custom Radio Buttons and Checkboxen(opens in new tab) — Adrian Roselli
- Use Legend and Fieldset(opens in new tab) — Adrian Roselli
Related
- Radio buttons — for single-selection from a group
- Select — for dropdown selection
Variables
None for input