Skip to content
Aback UI

Radio Group

Mutually exclusive choices with arrow-key selection and a visible label.

BetaNew shared patternRegistry JSON (opens in a new tab)

Selected plan: team

Installation

Copy the source with the CLI to own and edit it, or import it from the npm package.

npx aback-ui@latest add radio-group

Writes components/ui/radio-group.tsx. First time in this project? Run npx aback-ui@latest init first, as the installation guide shows.

Usage

Import the parts you need from the installed file. The Code tab above has a complete, working example.

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

API reference

Props and composition points for Radio Group. Native element props pass through.

PropTypeDefaultDescription
value / defaultValue / onValueChangestring / string / (value: string) => voidNoneControlled or uncontrolled selection.
orientation"horizontal" | "vertical"NoneArrow-key direction for the group.
RadioGroupItem valuestringNoneThe value submitted and announced for this option. Required.
disabledbooleanNoneRemoves one option or the whole group from interaction.
aria-labelstringNoneNames the group when no visible legend or heading does.

Dependencies: radix-ui, plus the shared @/lib/utils helper.

Accessibility

Semantics, keyboard behavior, and the decisions that keep the component operable.

  • Radix exposes radiogroup and radio roles with aria-checked and a single tab stop for the group.
  • Arrow keys move between options and select as they go; Tab enters and leaves the group.
  • Associate a visible label with every item using htmlFor. Do not rely on the option value alone.
  • The checked state uses a solid fill and an inner mark, not colour alone. The square indicator is intentional.

Keyboard

KeyAction
TabEnter or leave the group.
ArrowUporArrowDownMove and select in a vertical group.
ArrowLeftorArrowRightMove and select in a horizontal group.
SpaceSelect the focused option without moving.

Used in production

The Aback products whose interfaces shaped this component.

This component is new in Aback UI. It has not shipped in an Aback product yet, so no production use is claimed.