Radio Group

A set of checkable buttons where no more than one of the buttons can be checked at a time.

API Reference
Loading...
Loading code...

Installation

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

Usage

import { Label } from "@/components/ui/label"
import { Radio, RadioGroup } from "@/components/ui/radio-group"
<RadioGroup defaultValue="next">
  <Label>
    <Radio value="next" /> Next.js
  </Label>
  <Label>
    <Radio value="vite" /> Vite
  </Label>
  <Label>
    <Radio value="astro" /> Astro
  </Label>
</RadioGroup>

Examples

For accessible labelling and validation, prefer using the Field component to wrap radio buttons. See the related example: Radio Group field.

Disabled

Loading...
Loading code...

With Description

Loading...
Loading code...

Card Style

Loading...
Loading code...

Form Integration

Loading...
Loading code...

Comparing with Radix / shadcn

If you’re already familiar with Radix UI and shadcn/ui, this guide highlights the small differences and similarities so you can get started with ui/topia quickly.

Quick Checklist

  • Use Radio going forward; RadioGroupItem remains for legacy
  • If you used asChild on parts, switch to the render prop