Skip to content

Radio

Choose exactly one option from a related set.

Installation

Terminal
pnpm dlx shadcn@latest add https://react-toolbox.io/r/radio.json

New here? Set up your project first. Styles, fonts, and required components are included.

Usage

Give each RadioButton a distinct value and visible label, and name the group with aria-label or aria-labelledby.

State and callbacks

RadioGroup accepts value/onChange or defaultValue. A standalone RadioButton accepts checked/onChange or defaultChecked. Both support native form submission and reset.

API reference

Key props and defaults. Full types and inline documentation are included with the source in material/radio.

RadioGroup

Property Type Default
defaultValue string —
disabled boolean false
name string —
onChange (value: string | undefined, event: React.MouseEvent<HTMLInputElement>) => void —
required boolean —
value string —

Material guidelines

  • Use a radio group for one choice among mutually exclusive options. Show alternatives together when comparing them helps the decision.
  • Label both the group and its options. Use a dropdown when the available space or number of choices makes an inline group impractical.

Material Design 1: Selection controls