Skip to content

Checkboxes

React wraps Base UI’s Checkbox.Root (a <button role="checkbox">); vanilla styles a native <input type="checkbox"> with the same classes.

<input type="checkbox" class="checkbox" />
<input type="checkbox" class="checkbox" checked />
<input type="checkbox" class="checkbox" disabled />
<input type="checkbox" class="checkbox" disabled checked />

Set imperatively in vanilla via node.indeterminate = true; React takes an indeterminate prop. The CSS treats it identically to checked.

<input type="checkbox" class="checkbox" id="indeterm" />
<script>
document.getElementById("indeterm").indeterminate = true;
</script>

A <label> wrapping a .checkbox lays out inline automatically.

One short email per month. Unsubscribe anytime.

<div class="field">
<label class="field-label">
<input type="checkbox" class="checkbox" name="newsletter" />
Subscribe to the newsletter
</label>
<p class="field-description">
One short email per month. Unsubscribe anytime.
</p>
</div>