shadcn

Radio Group

Forms 18

About

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

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Radio Group to your project and fits it to your theme.

Code

How Radio Group is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

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

export function RadioGroupDemo() {
  return (
    <RadioGroup defaultValue="comfortable">
      <div className="flex items-center space-x-2">
        <RadioGroupItem value="default" id="r1" />
        <Label htmlFor="r1">Default</Label>
      </div>
      <div className="flex items-center space-x-2">
        <RadioGroupItem value="comfortable" id="r2" />
        <Label htmlFor="r2">Comfortable</Label>
      </div>
      <div className="flex items-center space-x-2">
        <RadioGroupItem value="compact" id="r3" />
        <Label htmlFor="r3">Compact</Label>
      </div>
    </RadioGroup>
  )
}

Dependencies

More by shadcn

View all
  • Navigation menu

    Navigation menu

    796
  • Calendar with time pressets

    Calendar with time pressets

    520
  • Sidebar

    Sidebar

    355
  • Sonner

    Sonner

    244
  • Chart

    Chart

    223
  • Icons

    Icons

    205
  • Dropdown Menu

    Dropdown Menu

    157
  • Calendar with event slots

    Calendar with event slots

    124

More in Forms

View all
  • Premium Auth

    Premium Auth

    552
  • Login 1

    Login 1

    60
  • Book A Demo 1

    Book A Demo 1

    84
  • Contact Card

    Contact Card

    1.1K
  • Authentication Card

    Authentication Card

    50
  • Form

    Form

    137
  • SignInPage

    SignInPage

    728
  • Form

    Form

    16