Skip to content
GitHub (opens in a new tab)

RadioGroup

Choose exactly one option from a small visible set.

stableMoleculecontracts/radiogroup.json

Preview

RadioGroup

Single-select choices for settings and forms. Each in lg, md, and sm. Not a Radio cousin.

Master

Two plans at lg with Studio Pro picked. Variants shows sizes, error, disabled and card layouts.

Plan

Usage

Use radios for a single choice in a short list. Group related options and keep one selected value per group. Do not invent Radio.

Do's

  • Two to six mutually exclusive options that should stay visible
  • Settings where users compare options side by side
  • A card picker for assignees, payment methods or notification options with a leading avatar, brand mark or icon (layout=card)

Don'ts

  • A plan or option that needs a price slot — use TileGroup
  • Long option lists — use Select
  • Independent booleans — use Checkbox
  • Instant on/off — use Switch
  • Tabs for panel switching — use Tabs
<RadioGroup
  name="plan"
  legend="Plan"
  size="lg"
  value="pro"
  options={plan}
  onChange={() => {}}
/>

Choose exactly one option from a small visible set. Custom circle, not a native radio. One piece.

When to use

  • Two to six mutually exclusive options that should stay visible
  • Settings where users compare options side by side
  • A card picker for assignees, payment methods or notification options with a leading avatar, brand mark or icon (layout=card)

When not to use

  • A plan or option that needs a price slot — use TileGroup
  • Long option lists — use Select
  • Independent booleans — use Checkbox
  • Instant on/off — use Switch
  • Tabs for panel switching — use Tabs

What an agent reads

import { RadioGroup } from "agentic-ds-kit";
must
  • The fieldset has role=radiogroup and is named by its legend (aria-labelledby)
  • Each radio is a native input type=radio with a visible label
  • error sets aria-invalid on the radiogroup, not on each radio; the error or hint is the group's aria-describedby
  • Disabled options stay in the a11y tree but cannot be selected
  • In layout=card each radio is named by its label only (aria-labelledby); the badge and description join its aria-describedby
  • Leading avatar and icon are aria-hidden; put any meaning they carry (card type, last digits) in the label
  • Arrow keys and the native radio behaviour are unchanged; focus-visible draws the kit ring on the whole card
defaults
  • size md
  • orientation vertical
  • disabled false
  • hideLegend false
  • layout list
stops if
  • Do not invent Radio, RadioGroupItem, or RadioGroupLegend cousins
  • Do not use a native unstyled radio with accent-color
  • Do not use raw hex
  • Do not use for tabbed content — use Tabs
  • Do not use for multi-select — use Checkbox
  • Do not set both avatar and icon on one option; avatar wins
  • Do not put a price in description or badge — use TileGroup
  • Do not let a brand mark or avatar carry meaning the label does not say

From contracts/radiogroup.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
describedBystringNo—Extra id(s) for aria-describedby on the group, after the hint or error.
namestringYes——
legendstringYes—Fieldset legend.
sizesm | md | lgNomd—
orientationvertical | horizontalNovertical—
optionsarrayYes——
defaultValuestringNo——
valuestringNo—controlled
onChangefunctionNo—(value: string) => void
disabledbooleanNofalseLocks the whole group.
errorstringNo—Group error message. Tints the radios.
hintstringNo——
hideLegendbooleanNofalseKeeps the legend for assistive tech, hides it visually. Use when Drawer already shows the title.
layoutlist | cardNolistcard is bordered rows with the radio on the right, an optional leading avatar or icon, and a kit focus ring on the whole card. Compose Badge via option.badge. Need a price? Use TileGroup.
  • Component
    →

    TileGroup

    Selectable cards for a plan or option picker.

  • Component
    →

    Select

    Choose one or several options from a list.

  • Component
    →

    Checkbox

    Multi-select or confirmation control.

  • Component
    →

    Switch

    Immediate on/off setting.