Genesis
@beta

ChoiceCard

ChoiceCard — one option as a card a person picks (a plan, a class, an answer with a picture): the twin of genesis-ui-native's NativeChoiceCard, with the same `title`, `description`, `media`, `multiple`, `invalid` and `disabled`. One of several (the default) is a radio built on the RadioGroup's item, so it goes in a `RadioGroup` with a label: the group is one tab stop, the arrow keys move the choice, and the group's `value` is the chosen card's. With `multiple` it is a checkbox with its own `selected` and `onSelectedChange`; put those in an element with `role="group"` and a label. ```tsx <RadioGroup aria-label="Plan" value={plan} onValueChange={setPlan}> <ChoiceCard value="monthly" title="Monthly" description="$20 a month" /> <ChoiceCard value="yearly" title="Yearly" description="$200 a year" /> </RadioGroup> ``` The card's surface is the Card's (`bg-card`, `border`, `rounded-lg`).

packages/ui/src/components/ui/choice-card.tsx

Import
Subpath export: @marktiderman/genesis-ui
import { ChoiceCard } from "@marktiderman/genesis-ui";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

ChoiceCard

ChoiceCard — one option as a card a person picks (a plan, a class, an answer with a picture): the twin of genesis-ui-native's NativeChoiceCard, with the same `title`, `description`, `media`, `multiple`, `invalid` and `disabled`. One of several (the default) is a radio built on the RadioGroup's item, so it goes in a `RadioGroup` with a label: the group is one tab stop, the arrow keys move the choice, and the group's `value` is the chosen card's. With `multiple` it is a checkbox with its own `selected` and `onSelectedChange`; put those in an element with `role="group"` and a label. ```tsx <RadioGroup aria-label="Plan" value={plan} onValueChange={setPlan}> <ChoiceCard value="monthly" title="Monthly" description="$20 a month" /> <ChoiceCard value="yearly" title="Yearly" description="$200 a year" /> </RadioGroup> ``` The card's surface is the Card's (`bg-card`, `border`, `rounded-lg`).

PropTypeDefaultDescription
onSelectedChange*(selected: boolean) => void—Called when it is pressed (Space, or a click), with the new state.
selected*boolean—
title*ReactNode—
value*string—This card's value in its RadioGroup.
classNamestring—
descriptionReactNode—A second line under the title, muted.
disabledboolean—
invalidboolean—The question still needs an answer: a destructive border, and said to screen readers.
mediaReactNode—Left of the text: a thumbnail, an icon.
multipleboolean—
testIDstring—
Storybook
Storybook hosts the canonical visual reference with controls for every variant.