{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "radio-group5",
  "title": "Radio group",
  "description": "Radio group built with shadcn/ui.",
  "registryDependencies": [
    "input",
    "label",
    "radio-group"
  ],
  "files": [
    {
      "path": "contents/components/radio-group/5/index.tsx",
      "content": "\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { RadioGroup, RadioGroupItem } from \"@/components/ui/radio-group\";\n\nexport default function Component() {\n  const radioId = useId();\n  const inputId = useId();\n  const [selectedValue, setSelectedValue] = useState(\"without-expansion\");\n  const inputRef = useRef<HTMLInputElement>(null);\n\n  useEffect(() => {\n    if (selectedValue === \"with-expansion\" && inputRef.current) {\n      inputRef.current.focus();\n    }\n  }, [selectedValue]);\n\n  return (\n    <RadioGroup className=\"gap-6\" onValueChange={setSelectedValue} value={selectedValue}>\n      <div>\n        <div className=\"flex items-start gap-2\">\n          <RadioGroupItem\n            aria-controls={inputId}\n            aria-describedby={`${radioId}-1-description`}\n            id={`${radioId}-1`}\n            value=\"with-expansion\"\n          />\n          <div className=\"grow\">\n            <div className=\"grid grow gap-2\">\n              <Label htmlFor={`${radioId}-1`}>Home delivery</Label>\n              <p className=\"text-muted-foreground text-xs\" id={`${radioId}-1-description`}>\n                Delivered to your doorstep within 2-3 business days.\n              </p>\n            </div>\n            {/* Expandable field */}\n            <div\n              aria-labelledby={`${radioId}-1`}\n              className=\"grid transition-all ease-in-out data-[state=collapsed]:grid-rows-[0fr] data-[state=collapsed]:opacity-0 data-[state=expanded]:grid-rows-[1fr] data-[state=expanded]:opacity-100\"\n              data-state={selectedValue === \"with-expansion\" ? \"expanded\" : \"collapsed\"}\n              id={inputId}\n              role=\"region\">\n              <div className=\"pointer-events-none -m-2 overflow-hidden p-2\">\n                <div className=\"pointer-events-auto mt-3\">\n                  <Input\n                    aria-label=\"Delivery address\"\n                    disabled={selectedValue !== \"with-expansion\"}\n                    id=\"radio-05-additional-info\"\n                    placeholder=\"Enter your address\"\n                    ref={inputRef}\n                    type=\"text\"\n                  />\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"flex items-start gap-2\">\n        <RadioGroupItem\n          aria-describedby={`${radioId}-2-description`}\n          id={`${radioId}-2`}\n          value=\"without-expansion\"\n        />\n        <div className=\"grid grow gap-2\">\n          <Label htmlFor={`${radioId}-2`}>Pick up at store</Label>\n          <p className=\"text-muted-foreground text-xs\" id={`${radioId}-2-description`}>\n            Collect your order from our nearest store location.\n          </p>\n        </div>\n      </div>\n    </RadioGroup>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/radio-group5.tsx"
    }
  ],
  "type": "registry:component"
}