Skip to Content

Checkbox

A brandless checkbox input. Uses appearance: none — the browser’s native rendering is fully removed. Color properties use CSS system color keywords as fallbacks so the unstyled component is visible without any tokens set.

Usage

import { Checkbox } from '@froglet/ui' const [checked, setChecked] = useState(false) <Checkbox checked={checked} onChange={() => setChecked(!checked)} /> // Themed <Checkbox className="checkbox--brand" checked={checked} onChange={handleChange} />

Props

PropTypeDescription
checkedbooleanControlled checked state.
onChange(e: ChangeEvent<HTMLInputElement>) => voidCallback fired when checked state changes.
classNamestringAdditional CSS classes. Use to apply a token block.
refReact.Ref<HTMLInputElement>Forwarded to the underlying <input>.
...propsInputHTMLAttributes<HTMLInputElement>All standard input attributes (disabled, aria-*, etc.).

CSS Custom Properties

TokenDefaultDescription
--checkbox-size1remWidth and height.
--checkbox-border-width2pxBorder width.
--checkbox-border-stylesolidBorder style.
--checkbox-border-colorcurrentColorBorder color.
--checkbox-border-radius4pxCorner radius.
--checkbox-background-colortransparentBackground (unchecked).
--checkbox-border-color-hovercurrentColorBorder color on hover.
--checkbox-background-color-hovertransparentBackground on hover.
--checkbox-outline-width-focus2pxFocus ring width.
--checkbox-outline-color-focuscurrentColorFocus ring color.
--checkbox-outline-offset-focus2pxFocus ring offset.
--checkbox-border-color-checkedcurrentColorBorder color when checked.
--checkbox-background-color-checkedcurrentColorBackground when checked.
--checkbox-checkmark-color-checkedCanvasCheckmark color when checked.
--checkbox-border-color-disabledGrayTextBorder color when disabled.
--checkbox-background-color-disabledCanvasBackground when disabled.
--checkbox-checkmark-color-disabledGrayTextCheckmark color when disabled.

Accessibility

  • Renders as a semantic <input type="checkbox"> with full keyboard and screen reader support.
  • Focus is indicated via :focus-visible.
  • Always associate a visible label using a <label> element or aria-label.
Last updated on