Design system/Components
Radio group
A radio picks one of several options when every option needs to be visible with its description. A 20px circle, an 8px dot, and a fieldset with a title.
In codecomponents/controls.tsx (RadioGroup)
Live example
The group is in a fieldset with a legend; the arrow keys move between options, because a native radio input is underneath.
When
When to use it
- Two to six options that each need a line of description: “At the end of the period” or “Now”.
- A choice with a sensible default, where that default is selected from the start.
When not to
- More than six options: a picker.
- Short options with no descriptions that change the page view: a segmented control.
- A single option: a checkbox.
Size and state
Circle
20px · border 1.5px · r 999pxDot
8px #fff on var(--accent)Group title
12px / 700 · var(--text-secondary)Option spacing
0 · boxed: 8px- One option is always selected; a radio has no “none” unless “None” is itself an option.
- All other states, from hover to error, are the same as the checkbox.
Code
<RadioGroup
label={tr("کِی اعمال شود؟")}
value={when}
onChange={setWhen}
options={[
{ value: "end", label: tr("در پایان دوره"), description: tr("تا آخر دوره همین پلن میماند.") },
{ value: "now", label: tr("همین حالا") },
]}
/>Related pages