{
  "name": "radio",
  "type": "registry:ui",
  "framework": "react",
  "title": "Radio",
  "description": "One choice out of a short, visible list, with the ring and dot the client's settings panels use.",
  "dependencies": [
    "radix-ui"
  ],
  "files": [
    {
      "path": "ui/radio.tsx",
      "content": "\"use client\"\n\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * A radio group: one choice out of a short, visible list. Where a select menu\n * hides its options until asked, this shows them all, which is what the\n * client's settings panels use when there are two or three of them and the\n * difference between them matters.\n *\n * Radix owns the behaviour: the value, the single tab stop, the arrow keys\n * and the hidden input a form reads. Only the look is newt/ui's.\n */\nconst RadioGroup = React.forwardRef<\n  React.ComponentRef<typeof RadioGroupPrimitive.Root>,\n  React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root> & {\n    /** Accessible name for the group. */\n    label?: string\n  }\n>(({ className, label, ...props }, ref) => (\n  <RadioGroupPrimitive.Root\n    ref={ref}\n    aria-label={label}\n    className={cn(\"flex flex-col gap-1\", className)}\n    {...props}\n  />\n))\nRadioGroup.displayName = \"RadioGroup\"\n\nconst Radio = React.forwardRef<\n  React.ComponentRef<typeof RadioGroupPrimitive.Item>,\n  React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item> & {\n    /** A second line, when the choice needs a sentence to explain it. */\n    description?: React.ReactNode\n  }\n>(({ className, description, children, ...props }, ref) => (\n  <RadioGroupPrimitive.Item\n    ref={ref}\n    className={cn(\n      \"group flex cursor-pointer items-center gap-3 border-0 bg-transparent px-1 py-2 text-start font-[family-name:var(--newt-font-sans)] text-[15px] leading-5 text-newt-text-secondary\",\n      \"hover:text-newt-text-primary focus-visible:rounded-[var(--newt-radius-sm)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-newt-text-link\",\n      \"data-[state=checked]:text-newt-text-primary\",\n      \"disabled:cursor-not-allowed disabled:opacity-50\",\n      className\n    )}\n    {...props}\n  >\n    {/*\n     * The indicator stays mounted so it can be the ring as well as the dot:\n     * it carries `data-state`, and the dot grows from nothing.\n     */}\n    <RadioGroupPrimitive.Indicator\n      forceMount\n      aria-hidden=\"true\"\n      className={cn(\n        \"relative h-5 w-5 shrink-0 rounded-full border-2 border-newt-text-muted transition-colors duration-fast ease-newt\",\n        \"after:absolute after:top-1/2 after:start-1/2 after:h-2 after:w-2 after:rounded-full after:bg-newt-on-accent after:content-['']\",\n        // Centring, and the dot's grow: both carry the writing direction.\n        \"after:[transform:translate(calc(var(--newt-dir)*-50%),-50%)_scale(0)]\",\n        \"data-[state=checked]:border-newt-brand data-[state=checked]:bg-newt-brand\",\n        \"data-[state=checked]:after:[transform:translate(calc(var(--newt-dir)*-50%),-50%)_scale(1)]\",\n        \"group-hover:border-newt-text-secondary\",\n        // A disabled row does not answer the pointer, checked or not.\n        \"data-[disabled]:data-[state=unchecked]:group-hover:border-newt-text-muted data-[disabled]:data-[state=checked]:group-hover:border-newt-brand\"\n      )}\n    />\n    {description === undefined ? (\n      children\n    ) : (\n      <span className=\"flex min-w-0 flex-col gap-0.5\">\n        <span>{children}</span>\n        <span className=\"text-[13px] leading-[17px] text-newt-text-muted\">\n          {description}\n        </span>\n      </span>\n    )}\n  </RadioGroupPrimitive.Item>\n))\nRadio.displayName = \"Radio\"\n\nexport { Radio, RadioGroup }\n",
      "type": "registry:ui"
    }
  ]
}