Radio Group
A labeled set of radio buttons for choosing one option.
- Status
- ReadyBuild day 12 of 21
- Code
- In React
- Role
- Form
Usage
This demo is live, and the code below it is the same code, imports included. The component lives in src/ui of this repository and is not published to npm yet.
Pastes as editable layers. Shadows are not exported.
import { useState } from "react";
import { RadioGroup, type RadioOption } from "@/ui";
const options: RadioOption[] = [
{ value: "10", label: "10 years" },
{ value: "15", label: "15 years" },
];
export default function RadioGroupDemo() {
const [term, setTerm] = useState<string>("15");
return <RadioGroup label="Loan term" options={options} value={term} onChange={setTerm} />;
}Variants and states
Every specimen is the real component from src/ui, held in one state.
Pastes as editable layers. Shadows are not exported.
Props
- label
- string · default none
- Required. The fieldset legend.
- options
- { value, label }[] · default none
- Required. The choices.
- value, onChange
- string, (value) => void · default none
- Controlled value. Leave out value for an uncontrolled group.
- defaultValue
- string · default none
- The first choice when uncontrolled.
- orientation
- "vertical" | "horizontal" · default "vertical"
- Layout of the options.
- size
- "sm" | "md" | "lg" · default "md"
- Passed to every option.
- hint, error
- string · default none
- Helper line under the group. error replaces it and puts every option in the error state.
- disabled
- boolean · default none
- Disables the whole group.
- name
- string · default none
- Form field name. Generated when left out.
Figma to code
Figma properties by their exact names from Naming, and the React prop that carries each one. The table covers the shared properties that bear on this component; the Figma file decides which of them its component exposes. None means there is no prop for it yet.
- 🧰 Type
- orientation
- vertical or horizontal.
- 🔀 Count
- options
- 2 to 5 Item is the length of options.
- 🎯 State
- error, disabled
- Default, error, or disabled.
- Label, Helper Text
- label, hint
- The legend and the line below.
Accessibility
What the code in src/ui does today, and what it leaves to you.
Keyboard
- Tab enters the group on the selected option, or the first one when none is selected. The arrow keys move between options and select. Tab leaves.
- A disabled group is skipped.
Screen readers
- A fieldset with a legend, so the label is read when focus enters the group.
- The hint or error is linked to the fieldset with aria-describedby, so it is read when focus enters the group. Every option shows the error look.
What you still need to do
- Keep a choice selected by default when one is safe. A radio group cannot be cleared by the user.
- For one on/off choice, use a checkbox or a toggle.
When to use
Two to five options that people should see all at once.
Do and don't
Do
- Wrap the set in a fieldset with a legend.
- Pre-select the safest option when a default is needed.
Don't
- Use for more than five options: use a select.
- Leave the group without a legend.
Related
4 of 28 other molecules, same role and ready ones first.
- Amount InputAn input for money that formats the value as the user types.Ready
- ComboboxAn input that suggests matching options as the user types.Ready
- Date PickerChooses a date from a calendar or by typing.Ready
- File InputLets people choose or drop a file to upload.Ready
Status reflects the component tracker snapshot of 29 October 2026.