Checkbox
Terminal-styled checkbox with [x] and bullet variants. Standalone or CheckboxGroup with built-in arrow navigation.
Installation
dgadd is not public on npm yet. Until the first release, pack @diffgazer/add from the repository and install that tarball into this app, which is what puts dgadd on pnpm exec.
The hosted registry is not public yet because r.b4r7.dev does not resolve. Use this source checkout or a local registry preview until the endpoint returns 200.
Diffgazer packages are not yet published to npm. Until the first release, pack @diffgazer/ui and @diffgazer/keys from the repository and install those tarballs.
UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS once packages are available.
Usage
Examples
Variants
Highlight, Invalid, and Disabled
Group
Checklist
API Reference
Checkbox
CheckboxGroup
CheckboxItem
Data attributes
Accessibility
Keyboard Navigation
CheckboxGroup includes arrow-key navigation — with the vim aliases j/k — with wrapping and real focus movement. Control highlighted/onHighlightChange when external state coordination is needed, use autoFocus when activating a composite region, use keyboardNavigation to suspend only arrow handling, and use onNavigationBoundaryReached for composite focus handoff. Standalone Checkbox responds to Space when focused.
| Key | Action |
|---|---|
| Space | Toggles a focused standalone Checkbox or CheckboxItem. |
| ArrowUp / k | Moves focus to the previous enabled CheckboxItem inside CheckboxGroup. |
| ArrowDown / j | Moves focus to the next enabled CheckboxItem inside CheckboxGroup. |
| Home / End | Moves focus to the first or last enabled item. |
| Enter | Toggles the focused/highlighted enabled group item. |
Group with built-in keyboard navigation
Notes
Requires @diffgazer/keys (package mode)
CheckboxGroup's arrow-key navigation imports from the required @diffgazer/keys peer. Package consumers must install @diffgazer/keys with @diffgazer/ui; packages are not yet published to npm, so until the first release install both from locally packed tarballs. Importing @diffgazer/ui/components/checkbox without keys fails at module load with an error naming the missing @diffgazer/keys package. Standalone Checkbox still needs it because the subpath bundles the group. Copy/dgadd consumers do not need the package — copy mode rewrites the keyboard hooks to local source.
Indeterminate State
Checkbox supports a third state: checked='indeterminate' renders [-] in both indicator variants. This is useful for parent checkboxes representing partially-selected groups.
Glyph Hierarchy
The brackets are chrome and render muted; the inner mark keeps the control's tone at bold weight. A checked row is therefore the only place full-contrast ink appears in the glyph column, so a long checklist can be scanned instead of read bracket by bracket. The visible text is unchanged — the indicator still reads [x], [ ], or [-] — and the whole cell stays aria-hidden.
Indicator Variants
variant='x' (default) marks the checked state with [x]; variant='bullet' marks it with [*]. Both keep the same three-character width so mixed lists stay aligned, and neither reuses Radio's [●] dot — a checkbox never reads as a radio.
Built-in Navigation
CheckboxGroup handles arrow-key navigation with real focus movement through useNavigation. Enter toggles the focused/highlighted enabled item; Space continues to work through native/item semantics. Use autoFocus to focus the highlighted, selected, or first enabled item when the group becomes active. Use highlighted, onHighlightChange, keyboardNavigation, and onNavigationBoundaryReached when coordinating highlight state across adjacent UI. Every item value must be unique within a group.
Strikethrough (Checklist Mode)
Pass strikethrough to Checkbox or CheckboxGroup to apply line-through styling and muted color to checked item labels.
Source
Install via CLI: pnpm exec dgadd add ui/checkbox. Keyboard hooks are included as standalone copies. For the full experience, use --integration keys.
Highlighted source loads after this disclosure opens. Browse the source repository.