# Radio

- **Section:** Components
- **URL:** https://refast.fastapicloud.dev/docs/components/radio
- **Markdown:** https://refast.fastapicloud.dev/docs/components/radio.md
- **Source:** https://github.com/idling-mind/refast-docs/blob/main/docs/pages/components/form_inputs/radio.py
- **Live examples:** the widgets on this page need a browser; open the URL above to try them.
- **Applies to:** refast 0.12.2

Single radio button and grouped radio selection components. Use `RadioGroup` to group
multiple `Radio` items for single-choice selection.

```python
from refast.components import Radio, RadioGroup

RadioGroup(
    name="plan",
    label="Billing Plan",
    value="pro",
    orientation="vertical",
    on_change=ctx.callback(handle_change),
    children=[
        Radio(value="free", label="Free"),
        Radio(value="pro", label="Pro"),
        Radio(value="enterprise", label="Enterprise", disabled=True),
    ],
)
```

```python
RadioGroup(
    name="size",
    label="T-Shirt Size",
    value="medium",
    orientation="vertical",
    disabled=False,
    on_change=ctx.callback(handle_change),
    children=[
        Radio(value="small", label="Small"),
        Radio(value="medium", label="Medium"),
        Radio(value="large", label="Large"),
    ],
)
```

## Radio Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `value` | `str` | required | Value emitted when this radio is selected |
| `name` | `str \| None` | `None` | HTML name attribute (shared within a group) |
| `label` | `str \| None` | `None` | Label text |
| `description` | `str \| None` | `None` | Help text below the radio |
| `checked` | `bool` | `False` | Controlled checked state |
| `default_checked` | `bool` | `False` | Uncontrolled initial state |
| `required` | `bool` | `False` | Shows required asterisk |
| `disabled` | `bool` | `False` | Disables this radio button |
| `error` | `str \| None` | `None` | Error message |
| `on_change` | `Callback \| None` | `None` | Fired when this radio is selected |
| `class_name` | `str` | `""` | Extra Tailwind classes |

## RadioGroup Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `name` | `str \| None` | `None` | Group name for form submission |
| `children` | `list[Radio]` | `[]` | Radio items |
| `label` | `str \| None` | `None` | Group label |
| `description` | `str \| None` | `None` | Help text below label |
| `value` | `str \| None` | `None` | Controlled selected value |
| `default_value` | `str \| None` | `None` | Uncontrolled initial value |
| `orientation` | `"vertical" \| "horizontal"` | `"vertical"` | Layout orientation |
| `required` | `bool` | `False` | Shows required asterisk |
| `disabled` | `bool` | `False` | Disables all radios in the group |
| `error` | `str \| None` | `None` | Error message |
| `on_change` | `Callback \| None` | `None` | Fired with the newly selected value |
| `class_name` | `str` | `""` | Extra Tailwind classes |

---

Part of the Refast documentation: [all pages](https://refast.fastapicloud.dev/llms.txt), [everything on one page](https://refast.fastapicloud.dev/llms-full.txt), [search](https://refast.fastapicloud.dev/api/search?q=save_prop).
