Components/Form

Radio

Radios let a reader pick exactly one option from a group. Choosing an option clears whichever was chosen before, so the group always holds a single answer. They suit a question whose options should all stay visible while the reader decides between them.

import { Radio } from '@growth-protocol-ai/alpha';

On this page

Billing period
state
Radio.tsxtsx
1import { Radio } from '@growth-protocol-ai/alpha';
2
3<fieldset>
4 <legend>Billing period</legend>
5 <div>
6 <Radio
7 disabled={false}
8 loading={false}
9 name="billing"
10 value="monthly"
11 label="Monthly"
12 defaultChecked
13 />
14 </div>
15 <div>
16 <Radio name="billing" value="annual" label="Annual" />
17 </div>
18 <div>
19 <Radio name="billing" value="none" label="No preference" />
20 </div>
21</fieldset>

When to use

Reach for a group of radios when a question has one answer, a handful of options, and the reader is better off weighing them against each other than recalling them. Every option stays on the page, which is what the vertical room buys — so write the options as answers to a question the group states above them.

When not to use

A question that can take more than one answer is a set of checkboxes, and so is a lone yes or no: two radios that are each other’s opposite say the same thing with twice the furniture. Once the options are values to be picked from rather than a choice to be weighed — a country, a currency, a long list — a dropdown asks it in one line. A setting that takes effect the moment it is touched is a toggle, not an answer to be submitted.