Live demo
Demo source
Use radios when people must choose exactly one option from a small set and should see every option at once. For several selections, use checkboxes; for a long list, use a select.
Anatomy
A radio with three callouts: 1 marks the round control, 2 the label Label next to it, and 3 the description below the label.
- Radio shows whether the option is selected.
- Label names the option.
- Description (optional) adds detail about the option.
Groups
Radios with the same name form a group: selecting one clears the others.
Each radio reports its own checked state, so an application stores the
selected option and sets checked on each radio from it. Wrap a group in a
fieldset with a legend that names the choice, and give each group a
unique name on the page.
States
Radios are selected or unselected, with built-in hover and focus styles. Set
labelPlacement to before to put the label first. A disabled option cannot
be chosen. Set error with an errorDescription when a required choice is
missing: the control turns red and the message explains the correction.
The design also depicts a read-only state. This version of nv-fieldradio
has no readonly property; use disabled when an option must not change,
or present the chosen value as text when editing is unavailable.
Themes
The design includes Spark and Ocean appearances. Use the page's theme and mode controls to compare the live examples; retain the same labels, states and validation messages in each theme.
Guidelines
- Give each option a short, clear label, and order options logically.
- Don't use radios for actions; they select values.
- Preselect a sensible default unless people must make a deliberate choice.