# Radio group

Options where one is chosen, each with a diamond indicator.

[View Radio group on CyberSpec](https://www.cyberspec.dev/components/sidebar/radio-group)

## Component

Radio group belongs to the Choices group in the CyberSpec catalog. It uses @ui-sdk/react/radio, @ui-sdk/react/field.

## Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/radio-group.json
```

## Example

```tsx
"use client"

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

export default function RadioGroupDemo() {
  return (
    <>
      <RadioGroup
        label="Approach"
        defaultValue="quiet"
        options={[
          { value: "quiet", label: "Quiet", hint: "Ghostwrite the door logs. Nobody knows we came." },
          { value: "loud", label: "Loud", hint: "Through the front. Dex keeps the engine running." },
          { value: "talk", label: "Talk", hint: "Needs a broker on the crew.", disabled: true },
        ]}
      />
    </>
  )
}
```

## Install this example

```sh
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/radio-group-demo.json
```

## Resources

- [Interactive Radio group preview](https://www.cyberspec.dev/preview/radio-group)
- [Component catalog](https://www.cyberspec.dev/components.md)
- [Radio group source code](https://github.com/agnelnieves/cyberspec/blob/main/registry/cyber/ui/radio-group.tsx)
- [Shadcn registry item](https://www.cyberspec.dev/r/radio-group.json)
