# Radio Group

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

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown variants are available by appending `.md` to any URL or sending an `Accept: text/markdown` header. An agent skill is available at [/.well-known/agent-skills/site-skill.md](/.well-known/agent-skills/site-skill.md).



<ComponentPreview name="radio-group-demo" />

## Installation [#installation]

<Tabs defaultValue="cli">
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add https://shadcn-cssinjs.com/r/radio-group.json
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Install the following dependencies:
      </Step>

      ```bash
      pnpm add @base-ui/react @stylexjs/stylex
      ```

      <Step>
        Make sure [StyleX is configured](/docs/installation) and the design tokens are
        installed.
      </Step>

      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource name="radio-group" title="radio-group.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</Tabs>

## Usage [#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 [#composition]

Use the following composition to build a `RadioGroup`:

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

## Description [#description]

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

<ComponentPreview name="radio-group-description" />

## Choice Card [#choice-card]

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

<ComponentPreview name="radio-group-choice-card" />

## Fieldset [#fieldset]

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

<ComponentPreview name="radio-group-fieldset" />

## Disabled [#disabled]

Use the `disabled` prop on `RadioGroup` to disable all items.

<ComponentPreview name="radio-group-disabled" />

## Invalid [#invalid]

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

<ComponentPreview name="radio-group-invalid" />

## RTL [#rtl]

To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).

<ComponentPreview name="radio-group-rtl" direction="rtl" />

## API Reference [#api-reference]

See the [Base UI Radio Group](https://base-ui.com/react/components/radio-group#api-reference) documentation.
