Radio Cards
ProNewA radio group whose options are whole cards with a title, a description and a trailing value.
Installation
pnpm dlx shadcn@latest add @viewport/radio-cards
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| title* | React.ReactNodeThe name of the option. | — |
| description | React.ReactNodeA line that explains the option. | — |
| trailing | React.ReactNodeShown at the end of the card, e.g. a price or a badge. | — |
| icon | React.ReactNodeShown before the title instead of the radio dot. | — |
Accessibility
- Each card is the radio button, so the hit area is the whole card.
- Arrow keys move and select; the group takes a name.
- Selection changes color only, so the layout never shifts.
- Respects prefers-reduced-motion.