{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checkbox",
  "title": "Checkbox",
  "author": "@fma-ds/ds",
  "description": "A control for a single on/off/indeterminate value.\n\nPair it with an external `Label` (via `id`/`htmlFor`) laid out as a flex row, rather than passing label text as children.\n\n- **`CheckboxGroup`**: gathers several under one label and a `value` array (react-aria `CheckboxGroup`; each `Checkbox` takes a `value`).\n- **`CheckboxCard`**: a choice card — the whole card is the checkbox, its children are the content (an `IconTile`, `FieldContent` with `FieldTitle` and `FieldDescription`) and a square indicator sits at the end. Selected cards take a `primary` tint, hovered ones `accent`.",
  "dependencies": [
    "cn@^0.5.0",
    "lucide-react@^1.61.0",
    "react-aria-components@^1.22.1"
  ],
  "registryDependencies": [
    "@fma-ds/field"
  ],
  "files": [
    {
      "path": "src/core/checkbox/checkbox.tsx",
      "content": "import { cn } from \"cn\";\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport {\n  CheckboxGroup as CheckboxGroupPrimitive,\n  type CheckboxGroupProps,\n  Checkbox as CheckboxPrimitive,\n  type CheckboxProps,\n  composeRenderProps,\n} from \"react-aria-components\";\nimport { choiceCardClassName } from \"@/core/field/field\";\n\nfunction Checkbox({ className, children, ...props }: CheckboxProps) {\n  return (\n    <CheckboxPrimitive\n      data-slot=\"checkbox\"\n      className={cn(\n        \"peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary data-focus-visible:border-ring data-focus-visible:ring-3 data-focus-visible:ring-ring/50 data-invalid:border-destructive data-invalid:ring-3 data-invalid:ring-destructive/20 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:data-invalid:border-destructive/50 dark:data-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary data-selected:border-primary data-selected:bg-primary data-selected:text-primary-foreground data-invalid:data-selected:border-primary dark:data-selected:bg-primary\",\n        className,\n      )}\n      {...props}\n    >\n      {composeRenderProps(children, (children, { isSelected, isIndeterminate }) => (\n        <>\n          <span\n            data-slot=\"checkbox-indicator\"\n            className=\"grid place-content-center text-current transition-none [&>svg]:size-3.5\"\n          >\n            {(isSelected || isIndeterminate) && <CheckIcon />}\n          </span>\n          {children}\n        </>\n      ))}\n    </CheckboxPrimitive>\n  );\n}\n\n/**\n * A checkbox drawn as a card: the whole card toggles it. Children are the\n * card's content (an `IconTile`, a `FieldContent` with `FieldTitle` and\n * `FieldDescription`); a square indicator sits at the end. Use inside a\n * `CheckboxGroup` with a `value`, or alone.\n */\nfunction CheckboxCard({ className, children, ...props }: CheckboxProps) {\n  return (\n    <CheckboxPrimitive\n      data-slot=\"checkbox-card\"\n      className={composeRenderProps(className, (className) => cn(choiceCardClassName, className))}\n      {...props}\n    >\n      {composeRenderProps(children, (children, { isSelected, isIndeterminate }) => (\n        <>\n          {children}\n          <span\n            data-slot=\"checkbox-card-indicator\"\n            className=\"mt-0.5 ml-auto flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors group-data-indeterminate/choice-card:border-primary group-data-indeterminate/choice-card:bg-primary group-data-indeterminate/choice-card:text-primary-foreground group-data-selected/choice-card:border-primary group-data-selected/choice-card:bg-primary group-data-selected/choice-card:text-primary-foreground dark:bg-input/30 [&>svg]:size-3.5\"\n          >\n            {isIndeterminate ? <MinusIcon /> : isSelected && <CheckIcon />}\n          </span>\n        </>\n      ))}\n    </CheckboxPrimitive>\n  );\n}\n\n/**\n * Groups checkboxes under one label and one `value` array (each `Checkbox`\n * takes a `value`). A `Label` without `htmlFor` inside names the group.\n */\nfunction CheckboxGroup({ className, ...props }: CheckboxGroupProps) {\n  return (\n    <CheckboxGroupPrimitive\n      data-slot=\"checkbox-group\"\n      className={composeRenderProps(className, (className) =>\n        cn(\"grid w-full gap-2 data-[disabled]:opacity-50\", className),\n      )}\n      {...props}\n    />\n  );\n}\n\nexport { Checkbox, CheckboxCard, CheckboxGroup };\n",
      "type": "registry:component",
      "target": "components/fma-ds/checkbox.tsx"
    }
  ],
  "meta": {
    "status": "stable",
    "source": "customized",
    "license": "MIT",
    "origin": "shadcn/ui, style: aria-nova (base: react-aria-components). Pair with an external Label via id/htmlFor — Checkbox's own children slot is for a custom indicator override, not label text.",
    "tags": [
      "form",
      "react-aria",
      "selection",
      "nova"
    ],
    "contentHash": "a62172995df6"
  },
  "categories": [
    "forms"
  ],
  "type": "registry:ui"
}