UI.MD

Selection Card

Card-shaped radio and checkbox options for choosing one or several from a set.

Installation

$
npx shadcn@latest add https://ui.mattdowney.com/r/selection-card.json

Usage

import {
  SelectionCardGroup, SelectionCard, SelectionCardTitle, SelectionCardDescription,
} from "@/components/ui/selection-card"

Examples

Default

StarterFor side projects and quick experiments. One seat included.ProRecommendedFor growing teams that need shared workspaces and priority support.EnterpriseAdvanced controls, audit logs, and a dedicated account manager.

Multiple

Set type="multiple" and the cards become checkboxes: a square control, and any number can be picked at once. The value is an array of the picked values.

Product updatesNew features and improvements, sent as they ship.Weekly digestA Monday summary of everything that changed last week.Security alertsSign-in notifications and account activity you should know about.

Title only

The description is optional. With just a title, the card collapses to a single line and the control stays centred on it.

Billed monthlyBilled yearly

Disabled option

Disable a single card with disabled, or the whole set by putting disabled on the group. A disabled card dims and drops out of keyboard navigation.

Credit cardVisa, Mastercard, and American Express.Bank transferNot available in your region yet.

API Reference

PropTypeDefaultDescription
typeSelectionCardGroup"single" | "multiple""single"single renders radio cards (round control, one choice). multiple renders checkbox cards (square control, any number).
defaultValueSelectionCardGroupstring | string[]-The initially selected value, for uncontrolled usage. A string for single, an array of values for multiple.
valueSelectionCardGroup, SelectionCardstring | string[]-On the group, the controlled selection (use with onValueChange). On <SelectionCard />, the value this card contributes (required).
onValueChangeSelectionCardGroup(value: string | string[]) => void-Called with the new selection. A string for single, an array for multiple.
disabledSelectionCardGroup, SelectionCardbooleanfalseDisables every card, or a single card on <SelectionCard />.