Checkbox
Binary toggle with checked / unchecked / indeterminate states. Built on Radix Checkbox.
Install
Pull Checkbox from the barrel for everyday use, or the granular path when you want a tighter bundle.
import { Checkbox } from "@brika/clay";import { Checkbox } from "@brika/clay/components/checkbox";A minimal example
Drop this into a page. Native HTML attributes pass through to the underlying primitive.
'use client';
import { Checkbox } from '@brika/clay/components/checkbox';
/** Uncontrolled checkbox pre-checked for visible state. */
export default function CheckboxDefaultDemo() {
return (
<label className="inline-flex items-center gap-2 text-sm">
<Checkbox defaultChecked />
Accept terms and conditions
</label>
);
}Checkbox, every way
Controlled
Controlled checkbox with external state displayed alongside.
Form Group
A realistic notification preferences group with independent checkboxes and labels.
Indeterminate
Tri-state checkbox cycling through unchecked, indeterminate, and checked.
Sizes
Three size presets, sm, default, lg, side by side with labels.
Accessibility
- Built on Radix Checkbox; keyboard, focus, and
aria-checkedstate are handled automatically. - Indeterminate state surfaces as
checked="indeterminate"; AT announces "mixed". - Always pair with a visible label, wrap in
<label>or use matchinghtmlFor/id. - Disabled checkboxes are removed from the tab order.
Theme tokens
Every CSS variable Checkbox reads, with its default and the
dotted path you'd write in a ThemeConfig JSON
to override it. Set any of these in your theme to retune Checkbox
without touching component code.
Checkbox tokens
13 tokens--checkbox-unchecked-containercolorvar(--input-container)components.checkbox.uncheckedContainerBox background in the resting (unchecked) state.
--checkbox-unchecked-bordercolorvar(--input-border)components.checkbox.uncheckedBorderBox border color in the resting (unchecked) state.
--checkbox-checked-containercolorvar(--primary)components.checkbox.checkedContainerBox background when checked or indeterminate (`data-[state=checked]` / `data-[state=indeterminate]`).
--checkbox-checked-bordercolorvar(--primary)components.checkbox.checkedBorderBox border color when checked or indeterminate.
--checkbox-checked-glyphcolorvar(--primary-foreground)components.checkbox.checkedGlyphColor of the check / dash glyph painted inside a checked box.
--checkbox-invalid-bordercolorvar(--destructive)components.checkbox.invalidBorderBox border color when the checkbox has `aria-invalid="true"`. Defaults to the theme destructive hue.
--checkbox-invalid-ringcolorvar(--destructive)components.checkbox.invalidRingColor of the invalid-state focus halo. Painted at 20% opacity in light mode, 40% in dark mode for parity with other form controls.
--checkbox-sizesize1remcomponents.checkbox.sizeCheckbox box edge length.
--checkbox-radiusradiusvar(--radius-tight)components.checkbox.radiusCheckbox corner radius.
--checkbox-border-widthborder-width1pxcomponents.checkbox.borderWidthBorder width on the checkbox. Set non-zero for outline-style variants.
--checkbox-border-styleborder-stylesolidcomponents.checkbox.borderStyleBorder style on the checkbox (`solid`, `dashed`, `double`, `none`).
--checkbox-durationdurationvar(--motion-standard-duration)components.checkbox.durationTransition duration for checkbox state changes.
--checkbox-easingeasingvar(--motion-standard-easing)components.checkbox.easingTransition easing for checkbox state changes.
Override in a theme
Authoring a theme is plain JSON. Drop overrides under
components.checkbox, the names
are camelCase versions of the variable suffix.
{
"id": "my-theme",
"name": "My Theme",
"description": "...",
"accentSwatches": ["#000"],
"components": {
"checkbox": {
"radius": "var(--radius-tight)"
}
}
}
Then apply with applyTheme(myTheme)
(see the theming guide),
scope it to a subtree with themeToCssVars(myTheme, mode),
or consume any token directly in your own JSX with the matching Tailwind utility
(e.g. bg-checkbox-…) — see the
chips on each token row.
API reference
Props specific to Checkbox. Native HTML attributes pass through to the underlying primitive, see the component source on GitHub for the full type signature.