Talisman LogoTalisman Logo Design System
Browse documentation
Components

Radio group

Selects exactly one option from a short list, shown as radio dots or as bordered buttons.

Stableimport { RadioGroup } from "@repo/ui/radio-group";Source
orientation
<RadioGroup />

RadioGroup owns the selected value and the keyboard navigation. RadioGroupItem is one option. The item has no label of its own: place a Label next to it, or use variant="button" and put the text in the item.

When to use

  • To pick exactly one option from two to six, where seeing all of them helps the decision.
  • For a choice sent with a form, such as the reason to skip a task or the export format.

When not to use

  • More than six options. Use Select.
  • Options that need a title and a description. Use Radio card.
  • Picking several options. Use Checkbox.
  • A binary setting. Use Switch or Checkbox.
  • A filter that the user can clear. Use Radio filter.

Variants

Button

variant="button" draws each item as a bordered button with the label inside. The selected one gets a brand border. Pass indicator to replace the default dot.

Variant Use for
default A form. A 16px radio next to a Label.
button A short list of choices that should be easy to hit, such as formats.

States

Enabled, disabled and horizontal groups.

Content

  • Label every option with a noun phrase: “Documento ilegível”.
  • Keep options mutually exclusive and complete. Add “Outro” when needed.
  • Preselect an option only when there is a safe default.

Do and don’t

DoPair every item with a Label, so the text is clickable and announced.
PDF
Word (.docx)
Don'tDon't leave the item without a label. Nothing names the option for assistive technology.

Accessibility

  • Built on Radix Radio Group: the group has role="radiogroup" and each item has role="radio" with aria-checked.
  • Tab enters the group at the selected item, or at the first one when none is selected. Arrow keys move focus and selection, skip disabled items and wrap at the ends. Space selects the focused item.
  • Name the group with aria-label or aria-labelledby, or wrap it in a fieldset with a legend.
  • With variant="button", the item text is its accessible name. In the default variant, link a Label with htmlFor and the item id.
  • The focus ring appears only for keyboard focus (focus-visible).

Code

import { Label } from "@repo/ui/label";
import { RadioGroup, RadioGroupItem } from "@repo/ui/radio-group";

<RadioGroup
  aria-label="Motivo para pular a tarefa"
  onValueChange={setReason}
  value={reason}
>
  <div className="flex items-center gap-2">
    <RadioGroupItem id="ilegivel" value="ilegivel" />
    <Label htmlFor="ilegivel">Documento ilegível</Label>
  </div>
</RadioGroup>;

Props

RadioGroup
PropTypeDefaultDescription
disabledbooleanfalseDisables every item in the group
onValueChange(value: string) => void—Called with the value of the newly selected item
orientation"horizontal" | "vertical"undefinedDirection of arrow-key navigation
requiredbooleanfalseMarks the group as required for forms and assistive tech
valuestring—Controlled value of the selected item
RadioGroupItem
PropTypeDefaultDescription
valuestring—Unique value of the item. Required.
variant"default" | "button""default"Radio dot, or a bordered button with the label inside.
indicatorReactNode—Replaces the default selected indicator.
indicatorClassNamestring—Extra class for the indicator wrapper.
disabledbooleanfalseDisables this item. The group can also disable all items.

Known issues

Issue Effect
The default item is h-4 w-4 (16px) and its disabled style is disabled:opacity-50. Below the 24px hit target, and a translucent disabled state.
The default variant has no label slot. Each app builds its own label layout, so spacing and click targets vary.
The focus ring uses ring-offset-background. The Tailwind config only defines old-background. The class generates nothing. The offset falls back to Tailwind’s default, white.
No style for aria-invalid. A group cannot show a validation error.
Edit this page on GitHub