Unified UI

Radio

A radio group component with standard and card variants, built on Radix UI for full accessibility.

Overview

The RadioGroup component is used for selecting a single option from a set. It supports standard radio buttons, a card variant for richer selection UIs, descriptions, two sizes, horizontal/vertical orientation, and disabled states.


Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add radio
pnpm dlx @work-rjkashyap/unified-ui add radio
npx @work-rjkashyap/unified-ui add radio
bunx @work-rjkashyap/unified-ui add radio

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	RadioGroup,
	RadioGroupItem,
	RadioCard,
} from "@work-rjkashyap/unified-ui";

Examples

Basic Usage

Sizes

With Descriptions

Horizontal Orientation

Radio Card Variant

Disabled State

Combined Features


Props

RadioGroup

PropTypeDefaultDescription
valuestringControlled selected value.
defaultValuestringInitial selected value (uncontrolled).
onValueChange(value: string) => voidCallback when the selection changes.
size"sm" | "md""md"Size of all radio items in the group.
orientation"vertical" | "horizontal""vertical"Layout direction of items.
disabledbooleanfalseDisables all items in the group.
classNamestringAdditional CSS classes.

RadioGroupItem

PropTypeDefaultDescription
valuestringRequiredThe value of this radio item.
labelReactNodeClickable label text.
descriptionReactNodeAdditional description below the label.
disabledbooleanfalseDisables this individual item.
classNamestringAdditional CSS classes.

RadioCard

PropTypeDefaultDescription
valuestringRequiredThe value of this radio card.
labelReactNodeCard title / label text.
descriptionReactNodeDescription text below the label.
disabledbooleanfalseDisables this card.
classNamestringAdditional CSS classes.

Accessibility

Built on Radix UI's Radio Group primitive for full keyboard and screen reader support out of the box.

  • Arrow keys navigate between items within the group.
  • Space selects the focused item.
  • Each item has proper role="radio" and aria-checked attributes.
  • Labels are associated with their radio inputs for click-to-select behavior.
  • Focus ring is visible on keyboard navigation only (focus-visible).
  • Disabled items are excluded from the tab order and marked with aria-disabled.

Design Tokens

The Radio components use the following design system tokens:

TokenUsage
--primarySelected indicator color
--primary-foregroundSelected indicator dot
--borderDefault border color
--muted-foregroundDescription text color
--radius-fullRadio circle border radius
--radius-mdRadioCard border radius
--duration-fastTransition speed

On this page