Primitives
Checkbox
Binary or tri-state selection. Styled native HTML control.
A checkbox is the standard control for binary or multi-select choices: terms acceptance, feature toggles, filter inclusion. Zazz styles the native <input type="checkbox"> so the same accessibility, keyboard handling, and form submission you get from the browser is wrapped in a Zazz-themed appearance.
Default
export default function CheckboxDefault() { return ( <label className="checkbox-group"> <input className="checkbox" type="checkbox" defaultChecked /> <span className="form-label">I agree to the terms</span> </label> );}<label class="checkbox-group">
<input type="checkbox" class="checkbox" />
<span class="form-label">Checkbox label</span>
</label>The checkbox-group wrapper sets up flex alignment with --gap-xs between the input and the label. The checkbox class applies Zazz styling on top of the native input.
Tokens
| Property | Token / value |
|---|---|
| Width / height | --step-4 (1rem) |
| Border | 1px solid var(--border) (unchecked), --primary (checked) |
| Radius | --radius-xs |
| Background | --input (unchecked), --primary (checked) |
| Group gap | --gap-xs |
| Focus ring | --focus-ring |
The checked state targets input:checked:
.checkbox:checked {
border-color: var(--primary);
background-color: var(--primary);
}States
- Unchecked. Border
--border, background--input. - Checked. Border + background switch to
--primary. A checkmark appears via background-image or a child SVG. - Focus. Focus ring outlines the input.
- Disabled. Set
disabledon the input. Pointer events drop; contrast lowers. - Indeterminate. Set via JavaScript:
input.indeterminate = true. The checkbox shows a dash; styling matches checked.
Accessibility
- The native
<input type="checkbox">handles keyboard interaction (Space toggles), screen reader announcement, and form submission automatically. - Wrap each checkbox in a
<label>so clicking the label text toggles the input. - For a group of related checkboxes (filter options, multi-select), wrap the group in
<fieldset>with a<legend>describing the group. - For required boolean inputs (terms acceptance), use
requiredandaria-describedbyif the label needs supplementary explanation.
Cross-platform
| Platform | Reference |
|---|---|
| Figma | No Figma component (representative mockup only). |
| Webflow | checkbox class on the <input>. Group wrapper is checkbox-group. |
| CSS / Tailwind | The same class after installing utilities.css. |