For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
43
Sponsor

Radio Group

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

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

export function RadioGroupDemo() {

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/radio-group.json

Usage

import {
  RadioGroup,
  RadioGroupItem,
} from "@/components/ui/radio-group/radio-group";
<RadioGroup defaultValue="comfortable">
  <RadioGroupItem value="default" />
  <RadioGroupItem value="comfortable" />
</RadioGroup>

Composition

Use the following composition to build a Radio Group:

RadioGroup
├── RadioGroupItem
└── RadioGroupItem

Examples

Description

Standard spacing for most use cases.

More space between elements.

Minimal spacing for dense layouts.

import {
  Field,
  FieldContent,
  FieldDescription,
  FieldLabel,
} from "@/components/ui/field";

Choice Card

import {
  Field,
  FieldContent,
  FieldDescription,
  FieldLabel,
  FieldTitle,

Fieldset

Subscription Plan

Yearly and lifetime plans offer significant savings.

import {
  Field,
  FieldDescription,
  FieldLabel,
  FieldLegend,
  FieldSet,

Disabled

import { Field, FieldLabel } from "@/components/ui/field";
import {
  RadioGroup,
  RadioGroupItem,
} from "@/components/ui/radio-group";

Invalid

Notification Preference

Select how you want to be notified.

import {
  Field,
  FieldDescription,
  FieldLabel,
  FieldLegend,
  FieldSet,

RTL

To enable right-to-left support, see the RTL guide.

"use client";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import {
  RadioGroup,

API Reference

See the Base UI documentation for the full API.