Radio button
Also called radio group or option button
A round option in a group where choosing one clears the others, so people pick exactly one answer, like a plan or a shipping speed.
import { useId } from 'react';
import { Radio } from '@base-ui/react/radio';
import { RadioGroup } from '@base-ui/react/radio-group';
const PLANS = [
{ value: 'free', name: 'Free', price: '$0', detail: 'One project' },
{ value: 'pro', name: 'Pro', price: '$12/mo', detail: 'Unlimited projects' },
{ value: 'team', name: 'Team', price: '$30/mo', detail: 'Shared billing' }
];
export function PlanPicker() {
const labelId = useId();
// Arrow keys move the selection between plans, like native radios.
return (
<RadioGroup
name='plan'
defaultValue='pro'
aria-labelledby={labelId}
className='flex w-80 flex-col gap-2'
>
<p id={labelId} className='text-sm font-medium'>
Choose a plan
</p>
{PLANS.map((plan) => (
<label
key={plan.value}
className='flex cursor-pointer items-center gap-3 rounded-xl border p-4 transition-colors has-[[data-checked]]:border-blue-600 has-[[data-checked]]:bg-blue-500/10'
>
<Radio.Root
value={plan.value}
className='flex size-5 shrink-0 items-center justify-center rounded-full border bg-background outline-none focus-visible:ring-2 focus-visible:ring-ring data-checked:border-blue-600'
>
{/* The dot scales in from 0 on a curve that overshoots a touch, like a small spring. */}
<Radio.Indicator className='size-2.5 rounded-full bg-blue-600 transition-transform duration-200 ease-[cubic-bezier(0.34,1.56,0.64,1)] data-ending-style:scale-0 data-starting-style:scale-0' />
</Radio.Root>
<span className='flex-1'>
<span className='block text-sm font-medium'>{plan.name}</span>
<span className='text-sm text-muted-foreground'>{plan.detail}</span>
</span>
<span className='text-sm font-medium tabular-nums'>{plan.price}</span>
</label>
))}
</RadioGroup>
);
}Build the plan picker as card-style radio buttons for Free ($0), Pro ($12/mo), and Team ($30/mo). Use native radio inputs that share a name so the arrow keys work, make each whole card clickable with a blue border and a light blue background when selected, and scale the inner dot in from 0 with a spring over about 200ms. Pre-select Pro.
Paste into Layerwise or any AI coding tool.
What is Radio button?
Radio buttons come in groups. Each option has a small circle, and selecting one fills its circle with a dot while clearing the rest, like the preset buttons on an old car radio that gave them their name. A popular variation turns each option into a card with the price or details inside and a highlighted border on the chosen one.
Use radio buttons when people must pick exactly one of two to about six options and should see them all at once, such as a plan, a delivery speed, or a payment method. For longer lists, use a select or combobox, and for one setting that turns on and off, use a switch or checkbox.
Pre-select a sensible default when there is one, and keep the options in a predictable order. Native radio inputs that share a name get arrow-key navigation for free. Let the dot scale in with a quick spring of about 150 to 200ms, and make the whole card clickable.
Often confused with
- Checkbox
- Checkboxes allow any number of choices. Radio buttons allow exactly one per group.
- Segmented control
- A segmented control is a compact bar for a few short options, often switching a view. Radio buttons have room for longer labels and details.
Related terms
All termsCheckbox
A small square you tick to turn an option on or select an item, with a dash in a parent box when only some items are checked.
Segmented control
A compact row of two to five options in one pill-shaped track, where a sliding thumb marks the single selected option.
Card
A bordered, rounded container that groups one item’s image, title, details, and actions so it can sit in a list or grid with others.
Spring animation
An animation driven by simulated spring physics in place of a fixed duration and curve, so motion can overshoot, settle, and react naturally.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.