---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Radio group

A named group of options of which exactly one is chosen, for React and Tailwind CSS. Free, MIT.

Free. Its export: `RadioGroup`.

## Try it

Pick a plan with the pointer or the arrow keys and save it: the button is busy for a moment, then the current plan changes. The Free plan is refused, with the reason, for a workspace of five members. Look switches a plan chosen, none chosen yet, the Free plan off, or a plan whose words wrap; Orientation lays the plans in a row; Disabled turns the group off.

The save is a timer; the five members and the plans are our own sample.

## When to use

- A named group of options of which exactly one is chosen.
- Also called: radio buttons.

## When not to use

- For a few short options that apply at once use SegmentedControl.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Radio group on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-radio-group
```

```text
Add the Goop Radio group to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { RadioGroup, RadioGroupItem, RadioGroupLabel } from '@/components/ui/goop/radio-group';

<RadioGroup aria-label="Start the week on" defaultValue="monday">
  <RadioGroupLabel>
    <RadioGroupItem value="monday" /> Monday
  </RadioGroupLabel>
  <RadioGroupLabel>
    <RadioGroupItem value="sunday" /> Sunday
  </RadioGroupLabel>
</RadioGroup>
```

- Fits: flow (its recipe).
- In a form, give the group a `Field orientation="vertical"` or a heading of its own, never a settings row.
- height, width, padding, gap, corner, border, background, text, motion: add no class for these.

## API reference

### Options

- `value?: string` — The chosen option's value, for a group its caller holds (with `onValueChange`).
- `defaultValue?: string` — The option chosen at first render, for a group that holds its own choice.
- `onValueChange?: (value: string) => void` — Called with the option's value whenever a person chooses one.
- `name?: string` — The group's name, sent with the form; its own when left out.
- `disabled?: boolean = false` — Every option off: none takes the focus, a click or a key.
- `required?: boolean = false` — A form with this group cannot be sent until an option is chosen.
- `orientation?: 'vertical' | 'horizontal' = 'vertical'` — The options as a column or a row that wraps.

- State: value (value / defaultValue / onValueChange); drawn by data-disabled

### Parts

- `RadioGroupItem` — One option's radio, inside a RadioGroupLabel with its words; value is what the group reports; value: string — The value the group reports and sends when this option is chosen; also takes onChange?: (event: ChangeEvent<HTMLInputElement>) => void; required?: boolean; disabled?: boolean; form?: string
- `RadioGroupLabel` — One option's clickable row; put its RadioGroupItem in it first, then the option's words; also takes htmlFor?: string

- data-slot values (to select a part by): radio-group, radio-group-item, radio-group-label

## Keyboard

- ArrowUp / ArrowDown / ArrowLeft / ArrowRight: move selection
- Space: choose focused

## Accessibility

- The native element answers the keyboard.
- focus-visible, checked: the browser's own (:focus-visible, :checked): write nothing
- disabled: the attribute data-disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Segmented control](/themes/trail/components/segmented-control): One choice of two to five short options that applies at once — a view or a mode — drawn as touching segments in one pill.
- [Choice group](/themes/trail/components/choice-group): A form's question answered by ticking boxes or picking one described option.
- [Switch](/themes/trail/components/switch): An on/off control for a setting that takes effect at once.
- [Select](/themes/trail/components/select): One option from a short closed list.
