# Radio Group

> Group of radios with a single selected value.

Registry name: `radio-group`. HTML docs: https://ui.anuragroy.dev/component/radio-group.

## Install

```bash
npx shadcn@latest add https://ui.anuragroy.dev/r/radio-group.json
```

If the website is down: `npx shadcn@latest add https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/radio-group.json`.

Registry JSON: https://ui.anuragroy.dev/r/radio-group.json (GitHub: https://raw.githubusercontent.com/anurag-roy/ui.anuragroy.dev/main/public/r/radio-group.json).

## Import

Import paths follow the consumer `components.json` aliases. After a default install:

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

## Usage

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

export function Example() {
  return (
    <RadioGroup defaultValue="a" className="flex flex-col gap-2">
      <label className="flex items-center gap-2 text-sm">
        <Radio value="a" /> Option A
      </label>
    </RadioGroup>
  )
}
```

## API

### RadioGroup

Base UI RadioGroup. Value is a string.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | string | — |  |
| `defaultValue` | string | — |  |
| `onValueChange` | (value: string) => void | — |  |

## See also

- [HTML page](https://ui.anuragroy.dev/component/radio-group): Preview and the same docs in the site chrome.
- [Registry item](https://ui.anuragroy.dev/r/radio-group.json): Source files and dependencies.
- [Catalog](https://ui.anuragroy.dev/component): All components.
- [llms.txt](https://ui.anuragroy.dev/llms.txt): Agent index for this library.
