Radio Group
A single choice: pick exactly one option from a short list you can see all at once.
Visibility
Only you can see this project.
Everyone on the Design team can view and edit.
Anyone in the workspace can find it.
When to use it
Use Radio Group when people must pick exactly one option, and choosing one clears the others. It suits two to five options worth comparing, such as visibility, plans, or delivery speeds, because every option and its description stays visible.
If people can pick several, use checkboxes. If the options take too much room, or people already know what they want, use Select.
Radio GroupThis page
One choice, every option visible.
Visibility
Only you can see this project.
Everyone on the Design team can view and edit.
Anyone in the workspace can find it.
Two to five options worth comparing.
How it behaves
Use defaultValue for local state or value/onValueChange for controlled state. Pass name to submit the selected value with a form.
Label the group with aria-labelledby and each RadioGroupItem with a label using htmlFor and id. Arrow keys move the selection; Tab leaves the group.
Prefer a radio group for two to five options people should compare at a glance. Use Select for longer lists.
The selected dot scales in over 150ms. Reduced motion fades it instead, and keyboard changes are immediate.
Build it
Add it with the shadcn CLI:
1pnpm dlx shadcn@latest add https://jzbui.com/r/radio-group.jsonA complete example. Change the values to fit your product:
12345678910111213import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"
<p id="visibility" className="label-md">Visibility</p><RadioGroup aria-labelledby="visibility" name="visibility" defaultValue="team"> <div className="flex items-center gap-3"> <RadioGroupItem id="private" value="private" /> <label htmlFor="private" className="label-md">Private</label> </div> <div className="flex items-center gap-3"> <RadioGroupItem id="team" value="team" /> <label htmlFor="team" className="label-md">Team</label> </div></RadioGroup>The full source is yours to edit once installed: