Checkboxes allow users to select one or more options from a visible list.
- Users should be able to tap on or click on either the text label or the checkbox to select or deselect an option.
- List options vertically if possible; horizontal listings can make it difficult to tell which label pertains to which checkbox.
- Avoid using negative language in labels as they can be counterintuitive. For example, “I want to receive a promotional email” instead of “I don’t want to receive promotional email.”
- Make sure selections are adequately spaced for touch screens.
<div id="filters" class="filters is-open" style="border: none; padding: 20px;">
<div class="filter">
<fieldset class="js-filter" data-filter="checkbox">
<legend class="label" for="office">Office Sought</legend>
<ul>
<li>
<input id="cycle-checkbox-p" name="office" type="checkbox" value="P" tabindex="0">
<label for="cycle-checkbox-p">President</label>
</li>
<li>
<input id="cycle-checkbox-s" name="office" type="checkbox" value="S" tabindex="0">
<label for="cycle-checkbox-s">Senate</label>
</li>
<li>
<input id="cycle-checkbox-h" name="office" type="checkbox" value="H" tabindex="0">
<label for="cycle-checkbox-h">House</label>
</li>
</ul>
</fieldset>
</div>
</div>
<div id="filters" class="filters is-open" style="border: none; padding: 20px;">
<div class="filter">
<fieldset class="js-filter" data-filter="checkbox">
<legend class="label" for="office">Office Sought</legend>
<ul>
<li>
<input id="cycle-checkbox-p" name="office" type="checkbox" value="P" tabindex="0">
<label for="cycle-checkbox-p">President</label>
</li>
<li>
<input id="cycle-checkbox-s" name="office" type="checkbox" value="S" tabindex="0">
<label for="cycle-checkbox-s">Senate</label>
</li>
<li>
<input id="cycle-checkbox-h" name="office" type="checkbox" value="H" tabindex="0">
<label for="cycle-checkbox-h">House</label>
</li>
</ul>
</fieldset>
</div>
</div>
/* No context defined. */