# Radio Group · JGuang UI

> A set of checkable buttons—known as radio buttons—where no more than one of the buttons can be checked at a time.

- Page: https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group
- Based on: shadcn/ui documentation (MIT) @ bc0705384b51252af26dcc65425b216bf5eb063c

> Example `radio-group-demo`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## Installation


  

**Command**


  

**Manual**


```text
Use the JGuang UI Registry URL provided on /systems/jguang-ui#install.
```


### Install the following dependencies:


```bash
npm install radix-ui
```


### Copy and paste the following code into your project.


[View complete source: components/ui/radio-group.tsx](/r/jguang-ui/radix/radio-group.json)


### Update the import paths to match your project setup.


## Usage

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

```tsx showLineNumbers
<RadioGroup defaultValue="option-one">
  <div className="flex items-center gap-3">
    <RadioGroupItem value="option-one" id="option-one" />
    <Label htmlFor="option-one">Option One</Label>
  </div>
  <div className="flex items-center gap-3">
    <RadioGroupItem value="option-two" id="option-two" />
    <Label htmlFor="option-two">Option Two</Label>
  </div>
</RadioGroup>
```

## Composition

Use the following composition to build a `RadioGroup`:

```text
RadioGroup
├── RadioGroupItem
└── RadioGroupItem
```

## Description

Radio group items with a description using the `Field` component.


> Example `radio-group-description`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## Choice Card

Use `FieldLabel` to wrap the entire `Field` for a clickable card-style selection.


> Example `radio-group-choice-card`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## Fieldset

Use `FieldSet` and `FieldLegend` to group radio items with a label and description.


> Example `radio-group-fieldset`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## Disabled

Use the `disabled` prop on `RadioGroupItem` to disable individual items.


> Example `radio-group-disabled`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## Invalid

Use `aria-invalid` on `RadioGroupItem` and `data-invalid` on `Field` to show validation errors.


> Example `radio-group-invalid`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## RTL

To enable RTL support in JGuang UI, see the [RTL configuration guide](/systems/jguang-ui/docs/rtl).


> Example `radio-group-rtl`: interactive preview on https://jiguang132.com/systems/jguang-ui/docs/components/radix/radio-group


## API Reference

See the [Radix UI Radio Group](https://www.radix-ui.com/docs/primitives/components/radio-group#api-reference) documentation.

---

Index of all JGuang resources: https://jiguang132.com/llms.txt
