Skip to content

Checkbox

<label class="label">
<input class="checkbox" type="checkbox" name="terms" />
Accept terms and conditions
</label>
StateHow
Checkedthe native checked attribute
Indeterminatedata-indeterminate on the input
Disabledthe native disabled attribute
Invalidaria-invalid="true"

The third state exists only as a DOM property — there is no HTML attribute for it, so server-rendered markup has no way to say it. partialkit closes that gap: put data-indeterminate on the input and the runtime sets the property.

<input class="checkbox" type="checkbox" data-indeterminate />

Toggling the checkbox clears it, the same way a real click resolves the third state.

Use it for a parent checkbox whose children are partly selected — never as a value of its own, since it does not submit.

A summary of what changed, every Monday.

.field-content keeps the title and description together beside the control, and clicking the title toggles it because for points at the input.

A set of checkboxes belongs in a <fieldset> with a <legend>, which names the group for every control inside it. Give them the same name so they submit as one list.

Notifications

Set dir="rtl" on the page or on any subtree — the control moves to the other side of its label on its own. See the button page for a live example.

  • The label is the hit area. Wrapping the input, or for pointing at its id, is what makes clicking the text toggle it — and what a screen reader announces.
  • The box has a larger hit target than it looks, extended beyond the 16px square, so it is reachable on touch without changing the layout.
  • Do not use a checkbox for an immediate action. A checkbox is a value in a form. Something that takes effect the moment you touch it is a switch.