Skip to main content
Version: latest
Works everywhere

Checkbox works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/checkbox) — the library detects the runtime automatically.

Checkbox

Checkbox renders an accessible <input type="checkbox"> with an associated label, optional helper text, and error feedback. Works in controlled and uncontrolled modes.

Live demo →

Overview

import { Checkbox } from "@prokodo/ui/checkbox"
;<Checkbox
name="terms"
label="I accept the terms and conditions"
checked={accepted}
onChange={e => setAccepted(e.target.checked)}
/>

Import

import { Checkbox } from "@prokodo/ui/checkbox"

CSS:

import "@prokodo/ui/checkbox.css"

Props

PropTypeDefaultRequiredDescription
valueT (generic)Value associated with this checkbox.
titleReactNodeLabel/title rendered next to the checkbox.
descriptionstringSecondary description text.
iconstringIcon name shown inside the card variant.
iconLabelstringAccessible label for the icon.
checkedbooleanControlled checked state.
defaultCheckedbooleanUncontrolled initial checked state.
disabledbooleanfalseDisable the checkbox.
requiredbooleanfalseMark field as required.
showRequiredMarkbooleanfalseShow required asterisk on the label.
variant"plain" | "card""plain"Visual variant.
colorVariantsAccent color variant.
onChange(checked: boolean, value: T) => voidCalled when checked state changes.
classNamestringCSS class on root element.

See src/components/checkbox/Checkbox.model.ts for the full CheckboxProps type.


Design Tokens

Customise Checkbox via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-checkbox-size1.125remCheckbox control size
--pk-checkbox-radiusvar(--pk-radius-md)Outer container radius
--pk-checkbox-control-radius6pxControl (checkbox box) radius
--pk-checkbox-control-bordervar(--pk-palette-grey-200)Unchecked border colour
--pk-checkbox-control-bgvar(--pk-palette-white)Unchecked background
--pk-checkbox-gradient-fromvar(--pk-color-brand)Checked gradient start
--pk-checkbox-gradient-tovar(--pk-color-accent)Checked gradient end
--pk-checkbox-fgvar(--pk-color-fg)Label text colour
--pk-checkbox-fg-mutedvar(--pk-color-muted)Helper text colour
--pk-checkbox-error-fgvar(--pk-color-error)Error text colour
--pk-checkbox-card-bgvar(--pk-color-surface)Card-style background

AIC Note

Use the standard import path in application code:

import { Checkbox } from "@prokodo/ui/checkbox"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.4.1Use of Color (A)🔍 Manual reviewColor must not be the only means of conveying information (e.g. error states, required field markers).
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
3.3.2Labels or Instructions (A)✅ FulfilledEvery form input requires a programmatically associated label or a visible instruction.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 5 test file(s) · 3 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Checkbox in Storybook


Source

src/components/checkbox/Checkbox.model.ts