Radio Group

A set of radio buttons where only one can be selected at a time.

@cupertinoui/radio-groupBase UI Radio Group Registry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/radio-group

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { Label } from "@/components/ui/label"
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"

<RadioGroup defaultValue="auto">
  <Label>
    <RadioGroupItem value="auto" /> Automatic
  </Label>
</RadioGroup>

Examples

Horizontal

API Reference

Every part forwards the props of the underlying Base UI Radio Group part. The props below are the ones CupertinoUI adds or changes.

RadioGroup

PropTypeDescription
valuestringThe selected value (controlled).
defaultValuestringThe initially selected value.
onValueChange(value: string) => voidCalled when the selection changes.
classNamestringExtra classes, merged with the component's own.

RadioGroupItem

PropTypeDescription
valuestringThe value of this option.
classNamestringExtra classes, merged with the component's own.