Mahmoud Ilyan

Radio Group

Forms

About

A set of circular radio buttons for selecting a single option from a list, built on Radix UI's radio group primitive.

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

"use client";

import * as React from "react";
import { Radio, RadioGroup } from "@/components/ui/radio";
import { Label } from "@/components/ui/label";

export default function RadioGroupDemo() {
  const [value, setValue] = React.useState("option1");

  return (
    <RadioGroup value={value} onValueChange={setValue}>
      <div className="flex items-center gap-2">
        <Radio value="option1" id="option1" />
        <Label htmlFor="option1" className="font-normal">
          Option 1
        </Label>
      </div>
      <div className="flex items-center gap-2">
        <Radio value="option2" id="option2" />
        <Label htmlFor="option2" className="font-normal">
          Option 2
        </Label>
      </div>
      <div className="flex items-center gap-2">
        <Radio value="option3" id="option3" />
        <Label htmlFor="option3" className="font-normal">
          Option 3
        </Label>
      </div>
    </RadioGroup>
  );
}

Dependencies

More by Mahmoud Ilyan

View all
  • Steps

    Steps

    5
  • Chart

    Chart

    2
  • Radio Card

    Radio Card

    1
  • Switch

    Switch

    1
  • Input

    Input

    1
  • Badge

    Badge

    1
  • Textarea

    Textarea

  • Tabs

    Tabs

More in Forms

View all
  • Premium Auth

    Premium Auth

    593
  • Contact Form

    Contact Form

    28
  • Form

    Form

    4
  • Login 1

    Login 1

    70
  • Book A Demo 1

    Book A Demo 1

    94
  • Contact Card

    Contact Card

    1.1K
  • HeroUI Field Error

    HeroUI Field Error

    13
  • Form [react-aria-components]

    Form [react-aria-components]

    19