Radio group
A set of radio buttons for picking exactly one option; a Radio needs a RadioGroup.
import { RadioGroup, Radio } from '@windmorph/react';Purpose
Radio buttons let people pick exactly one option from a set. Use them when all the options should be visible at once; for many options a Select is tidier, and for independent on/off choices use Checkbox.
Always wrap Radio options in a RadioGroup — the group owns the selection, the label, arrow-key navigation and validation. A Radio rendered outside a group throws.
List the options vertically, one per line, as M3 asks (“Avoid using horizontal radio button lists”): a column is quicker to scan and keeps each label beside its own button. Keep orientation="horizontal" for two or three short options, such as Yes and No.
When not to use
When any number of options may be selected use checkboxes; for a long list of choices use a Select.
See also
- Radio group on m3.material.io: Material's own guidelines, with anatomy and specs.
- Checkbox: Selects any number of options, with checked, unchecked and indeterminate states.
- Switch: Toggles a single setting on or off, with optional icons in the thumb.