Component

Radio

A single-select group of radio options with full keyboard and ARIA support. Built on the headless @refraction-ui/radio core.

Basic

Compose RadioItems inside a RadioGroup. Use defaultValue for uncontrolled state.

Installation

$pnpm add @refraction-ui/react-radio

Usage

tsx
import { RadioGroup, RadioItem } from '@refraction-ui/react'

export function MyComponent() {
  return (
    <RadioGroup defaultValue="standard" name="shipping">
      <RadioItem value="standard">Standard — 5-7 business days</RadioItem>
      <RadioItem value="express">Express — 2-3 business days</RadioItem>
      <RadioItem value="overnight">Overnight — next business day</RadioItem>
    </RadioGroup>
  )
}

Horizontal

Set orientation="horizontal" to lay items out in a row.

Controlled

Drive the selection from state with value and onValueChange.

Selected: weekly

Disabled

Disable the whole group via RadioGroup or a single option via RadioItem.

RadioGroup props

PropTypeDefaultDescription
valuestring--Controlled selected value. Pair with `onValueChange`.
defaultValuestring--Initial selected value when uncontrolled.
onValueChange(value: string) => void--Called with the newly selected value.
namestring--Form field name shared by the group.
orientation'vertical' | 'horizontal''vertical'Layout direction of the items.
disabledbooleanfalseDisables every item in the group.
classNamestring--Additional CSS classes for the group container.

RadioItem props

PropTypeDefaultDescription
valuestring--Unique value this item selects. Required.
childrenReact.ReactNode--Label content rendered beside the radio circle.
disabledbooleanfalseDisables just this item.
classNamestring--Additional CSS classes for the item label.