Skip to content

Forms

Checkbox

A label-wrapped checkbox on a native input.

stableNo JS requiredBuilt on <input type="checkbox">hydrateless/checkbox.css

A checkbox built on a native <input type="checkbox">, label-wrapped for a larger hit target. It keeps :checked, :focus-visible, the Space key, and form participation, with no JavaScript.

Checkbox

Live

Props

The framework bindings expose these props (and forward the rest to the root element).

PropTypeDefaultDescription
defaultCheckedbooleanInitial checked state (uncontrolled).
checkedbooleanControlled checked state; pair with `onCheckedChange`.

CSS variables

Override these on any ancestor to theme the component. See the theme studio to preview changes live.

CSS variableUsed for
--hl-primaryFill of the checked box.
--hl-borderBorder of the unchecked box.
--hl-radius-smCorner radius of the box.

Accessibility

  • Wrapping the input in a <label> makes the text a click target and labels the control.
  • A real checkbox keeps Space toggling, :focus-visible, and form submission.

Released under the MIT License.