Checkboxes
React wraps Base UI’s Checkbox.Root (a <button role="checkbox">); vanilla styles a native <input type="checkbox"> with the same classes.
Examples
Section titled “Examples”Default
Section titled “Default”<input type="checkbox" class="checkbox" /><input type="checkbox" class="checkbox" checked /><Checkbox /><Checkbox defaultChecked />Disabled
Section titled “Disabled”<input type="checkbox" class="checkbox" disabled /><input type="checkbox" class="checkbox" disabled checked /><Checkbox disabled /><Checkbox disabled defaultChecked />Indeterminate
Section titled “Indeterminate”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><Checkbox indeterminate />Inside a Field
Section titled “Inside a Field”A <label> wrapping a .checkbox lays out inline automatically.
One short email per month. Unsubscribe anytime.
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><Field name="newsletter"> <Field.Label> <Checkbox /> Subscribe to the newsletter </Field.Label> <Field.Description> One short email per month. Unsubscribe anytime. </Field.Description></Field>