Talisman LogoTalisman Logo Design System
Browse documentation
Components

Radio card

A radio option presented as a card, for choices that need a title and a short description.

Stableimport { RadioCard } from "@repo/ui/radio-card";Source

RadioCard only draws the card. It must be used inside a RadioGroup, which owns the selected value, the disabled state and the keyboard navigation.

When to use

  • To choose one option where each needs a title and a description, such as the review mode of a task.
  • When the options are few and a large target helps.

When not to use

  • Plain options with short labels. Use Radio group.
  • Picking several options. Use Checkbox card.
  • More than six options. Use Select.
  • A filter the user can clear. Use Radio filter.

States

One card selected and one disabled, in the same group.

Disabled group

Read only

Content

  • The title names the option: “Revisão por amostragem”.
  • The description says what changes when it is chosen, in one sentence.
  • Build the content with Typography spans. Do not put buttons or links in the card: the whole card is one control.

Do and don’t

DoPut the cards inside a labelled RadioGroup of two or more.
Don'tDon't offer a single card. A choice needs at least two options; use a Checkbox or a Switch for yes or no.

Accessibility

  • Built on Radix Radio Group: the group is role="radiogroup" and each card is one role="radio" control with aria-checked.
  • Tab enters the group at the selected card. Arrow keys move focus and selection, skip disabled cards and wrap at the ends. Space selects the focused card.
  • Name the group with aria-label or aria-labelledby. The card text is its accessible name. Use aria-labelledby and aria-describedby on the card to point at the title and the description.
  • The selected card shows a filled dot, a border and a background, so selection does not rely on color alone.
  • aria-readonly on the group only changes the style. Ignore the change in onValueChange.

Code

import { RadioCard } from "@repo/ui/radio-card";
import { RadioGroup } from "@repo/ui/radio-group";
import { Typography } from "@repo/ui/typography";

<RadioGroup aria-label="Modo de revisão" onValueChange={setMode} value={mode}>
  <RadioCard value="completa">
    <Typography as="span" variant="labelSm">
      Revisão completa
    </Typography>
  </RadioCard>
</RadioGroup>;

Props

RadioCard
PropTypeDefaultDescription
childrenReactNode—The card content. Compose a title and a description, and avoid nested interactive controls
disabledbooleanfalseDisables this card and dims it
valuestring—Unique value of this card inside the group

Every other prop of the Radix Radio Group item, such as id and required, is forwarded. asChild is not available.

Known issues

Issue Effect
Disabled is disabled:opacity-50 on the whole card. A translucent card, against the no-transparency rule. The text contrast can fall below AA.
aria-readonly is styled but not enforced. A read-only group still changes selection unless the app ignores the change.
No style for aria-invalid. A group of cards cannot show a validation error.
The focus ring has ring-offset-2 with no offset color token. The offset falls back to Tailwind’s default, white.
Edit this page on GitHub