# RadioGroup

A single-selection group of radios.

## Usage <a href="#usage" id="usage"></a>

```jsx
import { Component } from 'react'
import { Radio, RadioGroup } from '@aragon/ui'

const RADIO_LABELS = ['First', 'Second', 'Third']

class App extends Component {
  state = {
    activeId: 'first',
  }
  handleChange = activeId => {
    this.setState({ activeId })
  }
  render() {
    const { activeId } = this.state
    return (
      <RadioGroup onChange={this.handleChange} selected={activeId}>
        {RADIO_LABELS.map((label, i) => {
          const radioId = label.toLowerCase()
          return (
            <label key={i}>
              <Radio id={radioId} />
              {label}
            </label>
          )
        })}
      </RadioGroup>
    )
  }
}
```

## Demonstration

![](/files/8WuafjMAT70A8awfnBt5)

## Props <a href="#props" id="props"></a>

#### `className` <a href="#classname" id="classname"></a>

* Type: `String`

Sets the class name of the `radiogroup` container.

#### `selected` <a href="#selected" id="selected"></a>

* Type: `Function`: `(id: String|Number) -> *`

Id of selected radio, if any.

#### `onChange` <a href="#onchange" id="onchange"></a>

* Type: `Function`: `(id: String|Number) -> *`

This callback is called whenever the user selects a nested `<Radio />`.

#### **Arguments:**

* `id`: The value passed as the `<Radio />`'s `id` prop.

#### `children` <a href="#children" id="children"></a>

An arbitrary component tree that should eventually render at least one or more `<Radio />`s.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://legacy-docs.aragon.org/developers/tools/aragonui/data-entry/radiogroup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
