Skip to Content
⭐️ Leave a star →
ComponentsRadio

Radio

Single-selection radio group. Controlled via value and onChange. Items share a name attribute for native form semantics.

Features

Single-selection radio group.
Full keyboard navigation.
Can be controlled or uncontrolled.
Shared name attribute for native form semantics.
Supports disabled state per item or globally.

Example

Up to 5 active job postings

12GB6 CPUs160 GB SSD disk

Up to 25 active job postings

16GB8 CPUs512 GB SSD disk

Unlimited active job postings

32GB12 CPUs1024 GB SSD disk
import { Radio } from '@wire-ui/react' <Radio.Root name="plan"> {[ { value: 'startup', label: 'Startup', description: 'Up to 5 active job postings', ram: '12GB', cpus: '6 CPUs', disk: '160 GB SSD disk' }, { value: 'business', label: 'Business', description: 'Up to 25 active job postings', ram: '16GB', cpus: '8 CPUs', disk: '512 GB SSD disk' }, { value: 'enterprise', label: 'Enterprise', description: 'Unlimited active job postings', ram: '32GB', cpus: '12 CPUs', disk: '1024 GB SSD disk' }, ].map((plan) => ( <Radio.Item key={plan.value} value={plan.value}> <Radio.Indicator /> <div> <Radio.Label>{plan.label}</Radio.Label> <p>{plan.description}</p> </div> <div> <span>{plan.ram}</span> <span>{plan.cpus}</span> <span>{plan.disk}</span> </div> </Radio.Item> ))} </Radio.Root>

Styling

Radio items expose data-checked and data-disabled. Use the group utility in Tailwind to style child elements based on the parent’s state.

<Radio.Item className=" group border border-black data-[checked]:bg-gray-50 "> <span className=" border border-black rounded-full group-data-[checked]:bg-black "> <Radio.Indicator className="size-2 rounded-full bg-white" /> </span> <Radio.Label>Option</Radio.Label> </Radio.Item>

Using data attributes

Radio.Item sets data-checked when selected and data-disabled when disabled.

/* Selected item */ [data-checked] { background: #f5f5f5; } /* Radio dot */ [data-checked] .dot { background: #000; } /* Disabled */ [data-disabled] { opacity: 0.5; cursor: not-allowed; }

Root props

PropTypeDefaultDescription
valuestring | numberControlled selected value
defaultValuestring | numberInitial selected value
onChange(value: string | number) => voidCalled when selection changes
namestringauto-generatedShared name attribute for all radio inputs
disabledbooleanfalseDisables all items

Item props

PropTypeDescription
valuestring | numberThe value this item represents
disabledbooleanDisables this specific item

Indicator data attributes

AttributeValues
data-state"checked" / "unchecked"
data-disabledPresent when disabled

Keyboard Interactions

KeyDescription
ArrowDownMoves focus and selection to the next radio item.
ArrowUpMoves focus and selection to the previous radio item.
ArrowRightMoves focus and selection to the next radio item.
ArrowLeftMoves focus and selection to the previous radio item.
TabMoves focus to the selected radio item, or the first item if none is selected.
Last updated on

MIT License © 2026 wire-ui

Radio – Wire UI