Rime

RadioGroup

One choice from a few: a list, inline, or cards in 1 to 3 columns.

RadioGroup renders real radio inputs in a fieldset. The cards variant suits two to four choices that need a sentence each (a billing period, a plan).

Installation

npx shadcn@latest add KezLahd/rime/radio-group

Also installs: base, field.

Usage

import { RadioGroup } from "@/components/ui";

<RadioGroup aria-label="Billing period" value={period} onChange={setPeriod} options={[{ value: "monthly", label: "Monthly" }, { value: "yearly", label: "Yearly" }]} />

Examples

Cards

API

Generated from the component's TypeScript types and JSDoc (scripts/gen-ui-registry.mjs), so it always matches the source.

RadioGroup

RadioGroup props
PropTypeDefaultDescription
optionsRequiredReadonlyArray<RadioOption<V>>
valueRequiredV | null
onChangeRequired(value: V) => void
namestringShared native name. Generated if omitted; arrow keys work across the group natively.
variant"list" | "inline" | "cards""list"list = stacked radios. inline = radios in a row (Yes / No). cards = choice cards: title + description tiles (withdrawal source, delivery destination).
columns1 | 2 | 32cards only. Collapses to one column under 640px.
invalidboolean
disabledboolean
requiredboolean
aria-labelstring
aria-labelledbystring
classNamestring

Theme tokens

Per-component tokens are undeclared by default, so the default shown is the fallback the CSS uses. Set one at :root (or in theme.css) to restyle every instance. Live values are read from this page, so they follow the Rime Studio.

RadioGroup per-component tokens
TokenDefaultLive value
--columns2…

System tokens it reads

RadioGroup system tokens
TokenDefaultLive value
--brandtokens.css…
--brand-gradienttokens.css…
--danger-basetokens.css…
--danger-field-filltokens.css…
--durtokens.css…
--easetokens.css…
--focus-ringtokens.css…
--glow-smtokens.css…
--ink-bodytokens.css…
--ink-disabledtokens.css…
--ink-headingtokens.css…
--ink-mutedtokens.css…
--linetokens.css…
--neutral-bordertokens.css…
--r-lgtokens.css…
--rgb-brandtokens.css…
--rgb-brand-deeptokens.css…
--rgb-contacttokens.css…
--rgb-dangertokens.css…
--rgb-whitetokens.css…
--surface-solidtokens.css…
--surface-sunkentokens.css…
--text-bodytokens.css…
--text-captiontokens.css…
--text-smalltokens.css…

Accessibility

  • Arrow keys move the choice within the group, as native radios do.
  • Radio dots stay round in every theme: a square radio reads as a checkbox.

Do and don't

Do

  • Prefer RadioGroup over Select for 2 to 4 options.

Don't

  • Don't preselect a choice the user must consciously make (accepting terms, a paid plan).

For AI agents

This page as markdown, rendered from the same registry entry. Point an agent at it (or add .md to this page's URL), or at /llms.txt for the index.

Open radio-group.md