Unselected
A 20px circle with a 1px border/strong outline.
Lets people choose exactly one answer from a short list of options.
Updated
Radio
HTML
<div class="nds-radio"> <input class="nds-radio__input" type="radio" id="yes" name="name-change" value="yes" /> <label class="nds-radio__label" for="yes"> <span class="nds-radio__control" aria-hidden="true"> </span> <span class="nds-radio__text"> Yes </span> </label></div> WordPress
<!-- wp:nds/radio {} --><div class="nds-radio"> <input class="nds-radio__input" type="radio" id="yes" name="name-change" value="yes" /> <label class="nds-radio__label" for="yes"> <span class="nds-radio__control" aria-hidden="true"> </span> <span class="nds-radio__text"> Yes </span> </label></div><!-- /wp:nds/radio --> Usage
import { Radio } from "@nigerian-design-standards/react";<Radio label="Yes" name="name-change" value="yes"/> Usage
use NDS\Components\Radio;echo Radio::render([ 'label' => 'Yes', 'name' => 'name-change', 'value' => 'yes',]); Radios sit in a group, under a legend that asks the question, and people can choose only one. Use them for fewer than 7 options, so people can see them all.
The circle’s states. Disabled is also available, but explain why an option isn’t available instead where you can.
A 20px circle with a 1px border/strong outline.
action/primary/default border with a centred inner dot.
2px border/dark around the control. Not the keyboard focus ring.
A red border, always with the group’s error message.
The properties of the radio. The same in HTML, WordPress and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| label | string | any text | The option, in a few words. The whole label is clickable. |
| selected | boolean |
| Whether this option is chosen. Only one in a group. |
| name · value | string | any text | Sent with the form. Radios in one group share a name. |
| disabled | boolean |
| Avoid where you can: explain why an option isn’t available instead. |
In code, each option is an <input type="radio"> with a <label for>, so the whole label is clickable. Radios in a group share one name. Put the group in a <fieldset> with a <legend>; the hint and error ids go on the fieldset’s aria-describedby.
| Part | Token | Contrast on the page |
|---|---|---|
| Circle | 20px (size/icon/md) · radius/200 · surface/canvas | — |
| Border | border/strong, 1px | 4.2:1 |
| Selected dot | action/primary/default | 5.8:1 |
| Active | border/dark, 2px | 14.3:1 |
| Error | status/error/surface border, with the group’s error message | 4.9:1 |
| Label | Body/medium · text/primary | 17.6:1 |
| Spacing | spacing/100 8px circle to label · spacing/150 12px between options · spacing/300 24px in a fieldset | — |
Ask the question in the legend and stack the options, one per line.
Don’t put an error on one option. The group gets one error message under the legend.
How radios are laid out.
How to write the question, the options and the error.
Most common first, or a natural order like Yes, No.
Add “None of these” or “Prefer not to say” when it applies.
“Select if you have changed your name”.
Leave all options empty, so people make a real choice.
| Write | Don’t write | Why |
|---|---|---|
| Yes · No | Yes, I have · No, I haven’t | Short. |
| Select if you have changed your name | Please select an option | Says what to do. |
| Have you changed your name? | Name change status | A clear question. |
| Prefer not to say | N/A | Plain words. |
| Text message | SMS | Plain words, no jargon. |
Real radio inputs with labels, grouped in a fieldset with a legend.
| Key | What it does |
|---|---|
| Tab | Enters the group on the selected radio (or the first). Tab again leaves the group. |
| ↑ ↓ ← → | Moves to the next radio and selects it. |
| Space | Selects the focused radio. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use Form/Radio from 01 Library – Foundations, inside Form/Radio group for a question. Set Selected, State and the Label. Don’t detach it.
Is this page useful?