{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "radio-group",
  "title": "RadioGroup",
  "description": "One choice from a short list.",
  "registryDependencies": [
    "https://creance.pages.dev/r/creance-base.json",
    "https://creance.pages.dev/r/radio.json"
  ],
  "files": [
    {
      "path": "radio-group/RadioGroup.css",
      "content": ".cr-radio-group {\n  display: grid;\n  gap: var(--cr-space-3);\n  margin: 0;\n  padding: 0;\n  border: 0;\n  color: var(--cr-color-text-default);\n  font-family: var(--cr-font-family-sans);\n}\n\n.cr-radio-group__legend {\n  margin-bottom: var(--cr-space-3);\n  padding: 0;\n  font-size: var(--cr-font-size-sm);\n  font-weight: var(--cr-font-weight-semibold);\n}\n",
      "type": "registry:file",
      "target": "@components/creance/radio-group/RadioGroup.css"
    },
    {
      "path": "radio-group/RadioGroup.tsx",
      "content": "'use client';\n\nimport { useId, type ReactNode } from 'react';\nimport { Radio } from '@/components/creance/radio/Radio';\nimport { cx } from '@/lib/creance/cx';\nimport './RadioGroup.css';\n\nexport interface RadioOption {\n  value: string;\n  label: ReactNode;\n  description?: ReactNode;\n  disabled?: boolean;\n}\n\nexport interface RadioGroupProps {\n  /** The question the options answer. Rendered as the fieldset legend. */\n  legend: ReactNode;\n  options: RadioOption[];\n  value?: string;\n  defaultValue?: string;\n  onValueChange?: (value: string) => void;\n  /** Form field name. Generated if omitted. */\n  name?: string;\n  className?: string;\n}\n\n/** Native radios in a fieldset: arrow keys move between options, Tab leaves the group. */\nexport function RadioGroup({ legend, options, value, defaultValue, onValueChange, name, className }: RadioGroupProps) {\n  const auto = useId();\n  return (\n    <fieldset className={cx('cr-radio-group', className)}>\n      <legend className=\"cr-radio-group__legend\">{legend}</legend>\n      {options.map((o) => (\n        <Radio\n          key={o.value}\n          name={name ?? auto}\n          value={o.value}\n          label={o.label}\n          description={o.description}\n          disabled={o.disabled}\n          {...(value !== undefined ? { checked: value === o.value } : { defaultChecked: defaultValue === o.value })}\n          onChange={(e) => e.currentTarget.checked && onValueChange?.(o.value)}\n        />\n      ))}\n    </fieldset>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/creance/radio-group/RadioGroup.tsx"
    }
  ],
  "categories": [
    "molecule",
    "forms"
  ],
  "type": "registry:ui"
}