# Radio Group

Marbles dropped into sunken cups. Works as plain rows or as choice cards.

Docs: https://cozy-ui.solo.engineer/docs/components/radio-group/

Install: `npx shadcn@latest add @cozy/radio-group`

### Usage

```tsx
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
```

### Example

```tsx
import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";

export default function RadioGroupDemo() {
  return (
    <RadioGroup defaultValue="normal" aria-label="Difficulty">
      <Label className="cursor-pointer"><RadioGroupItem value="relaxed" /> Relaxed: crops never wilt</Label>
      <Label className="cursor-pointer"><RadioGroupItem value="normal" /> Normal</Label>
      <Label className="cursor-pointer"><RadioGroupItem value="busy" /> Busy farmer: more orders, more weather</Label>
    </RadioGroup>
  );
}
```

### Source (components/ui/radio-group.tsx)

```tsx
import * as React from "react";
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
import { cn } from "@/lib/utils";

function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
  return <RadioGroupPrimitive.Root data-slot="radio-group" className={cn("grid gap-3", className)} {...props} />;
}
function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
  return (
    <RadioGroupPrimitive.Item data-slot="radio-group-item" className={cn("cz-radio", className)} {...props}>
      <RadioGroupPrimitive.Indicator data-slot="radio-group-indicator">
        <span className="cz-radio__dot" />
      </RadioGroupPrimitive.Indicator>
    </RadioGroupPrimitive.Item>
  );
}

export { RadioGroup, RadioGroupItem };
```

npm: `import { RadioGroup, RadioGroupItem } from "@0xtrou/cozy-ui"` (after `npm install @0xtrou/cozy-ui` and `import "@0xtrou/cozy-ui/styles.css"`).
