Radio Group

Single-choice options with a dot that glides to the selection.

Radio Group

radio.tsx
"use client";

import { useState } from "react";
import { RadioGroup, RadioGroupItem } from "@/components/motion/radio";

export function RadioPreview() {
  const [plan, setPlan] = useState("pro");

  return (
    <RadioGroup value={plan} onValueChange={setPlan} className="min-w-48">
      <RadioGroupItem value="starter" label="Starter, free" />
      <RadioGroupItem value="pro" label="Pro, $12/mo" />
      <RadioGroupItem value="team" label="Team, $29/mo" />
      <RadioGroupItem value="legacy" label="Legacy plan" disabled />
    </RadioGroup>
  );
}

With Description

radio.tsx
"use client";

import { useState } from "react";
import { RadioGroup, RadioGroupItem } from "@/components/motion/radio";

export function RadioDescriptionPreview() {
  const [schedule, setSchedule] = useState("once");

  return (
    <RadioGroup value={schedule} onValueChange={setSchedule} className="w-full max-w-64">
      <RadioGroupItem
        value="once"
        label="Run once"
        description="Runs a single time, right now."
      />
      <RadioGroupItem
        value="schedule"
        label="Run on a schedule"
        description="Repeats on a set interval until stopped."
      />
      <RadioGroupItem
        value="trigger"
        label="Run on a trigger"
        description="Waits for an event before it starts."
      />
      <RadioGroupItem
        value="manual"
        label="Manual approval"
        description="Not available on your plan."
        disabled
      />
    </RadioGroup>
  );
}

API Reference

RadioGroup

value?
string

The selected value, for controlled use.

defaultValue?
string

The initial value when uncontrolled. Default: ""

onValueChange?
((value: string) => void)

Called with the item's value when the selection changes.

className?
string

Classes merged onto the root element.

orientation?
"vertical" | "horizontal"

Stacks items in a column or wraps them in a row. Default: "vertical"

Defaultvertical
aria-label?
string

Accessible name for the group when no visible label names it.

aria-labelledby?
string

Id of a visible element that names the group.

RadioGroupItem

value
string

The value the group takes when this item is picked.

label?
string

Text shown beside the radio, used as its name.

description?
string

Supporting text under the label, announced as the description rather than the name.

disabled?
boolean

Dims the item and stops it from being picked.

className?
string

Classes merged onto the item's label element.

id?
string

Id for the radio button. Default: a generated id

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/radio
Also on React Native. One dot glides to the option you pick.

Updated