Xzero UI
Pro library

Checkbox

A binary choice with a precise, legible state.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/checkbox
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/checkbox

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Checkbox } from "@/components/xzero/checkbox/checkbox";

export function TermsCheckbox() {
  const [accepted, setAccepted] = useState(false);
  return (
    <Checkbox
      label="I agree to the terms"
      description="You can export your data at any time."
      checked={accepted}
      onCheckedChange={(next) => setAccepted(next === true)}
    />
  );
}

API reference

Checkbox

A Radix checkbox whose check morphs into the indeterminate dash and back.

PropTypeDefaultDescription
labelstring–Visible label. Without it, pass aria-label; the fallback name is "Checkbox".
descriptionstring–Secondary copy under the label, linked through aria-describedby.
checkedboolean | "indeterminate"–Controlled state.
defaultCheckedboolean | "indeterminate"falseInitial state when uncontrolled.
onCheckedChange(checked: boolean | "indeterminate") => void–Called on every toggle.
...propsComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>–Radix Checkbox root props, including ref, name, value, required, and disabled.

Keyboard interactions

KeysAction
SpaceToggles the checkbox.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in toggles

Guidance for AI tools

Checkbox: A binary choice with a precise, legible state. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components