Skip to content

Checkbox

In review
Live · web

Form: multi-select, with a label + description (the box is the target)

Tri-state group: the parent reflects all / none / some of its children

States: tab in, toggle with Space

UncheckedCheckedMixedDisabled offDisabled onInvalid

Sizes & standalone use

SmallMedium

Toggled 0 times. The island is live.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform;
// this is the canonical API the published @dizyx/nockerl-react package exposes.
// NockerlCheckbox ships in the package, tri-state included (CheckedState covers 'mixed').
// See the drift note for the per-platform status.)
import { NockerlCheckbox } from '@dizyx/nockerl-react';
export function ScopePicker() {
const [scopes, setScopes] = useState({ repos: true, issues: false, prs: false });
const all = Object.values(scopes).every(Boolean);
const none = Object.values(scopes).every((v) => !v);
return (
<fieldset>
<NockerlCheckbox
label="Grant repository access"
checked={all ? true : none ? false : 'mixed'}
onChange={(on) => setScopes({ repos: on, issues: on, prs: on })}
/>
<NockerlCheckbox label="Repos" checked={scopes.repos} onChange={(v) => setScopes({ ...scopes, repos: v })} />
<NockerlCheckbox label="Issues" checked={scopes.issues} onChange={(v) => setScopes({ ...scopes, issues: v })} />
<NockerlCheckbox label="Pull requests" checked={scopes.prs} onChange={(v) => setScopes({ ...scopes, prs: v })} />
<NockerlCheckbox label="I am over 18" checked={false} invalid />
</fieldset>
);
}
PropTypeDefaultDescription
checked *CheckedStateTri-state checked value. 'mixed' renders the indeterminate dash.
onChange(next: boolean) => voidFired with the next boolean value. Ignored while disabled.
labelstringPersistent visible label (rendered beside the box, the box is its target).
descriptionstringSupporting line under the label.
sizeNockerlCheckboxSize'md'Box scale. md matches the platform default.
disabledbooleanfalseInert + clearly-seen (never invisible) state.
invalidbooleanfalseInvalid: warm error border + a "!" mark + a message. Color is never alone.
ariaLabelstringaria-label when there is no visible label (standalone / inline use).

Also accepts the native <input> attributes (e.g. onClick, disabled, id, aria-*, data-*), forwarded straight through, plus a forwarded ref.