Radio Cards, animated React component
A plan picker built on real radio inputs: the selection ring glides between cards, the chosen card opens to show its features, and the button label rolls to the new plan.
- Free
- Inputs & Controls
- Spring
Ticks when you pick a different plan. Sound is off on this site until you switch it on.
Like Radio Cards? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Radio Cards stays free.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| options | RadioOption[] | — | Each option has id, title, description, and optional meta (shown on the right) and features (chips shown when selected). |
| defaultValue | string | — | Id of the option selected at first. Defaults to the second option. |
| onChange | (id: string) => void | — | Called when the selection changes. |
| autoplay | boolean | false | Cycles through the options until someone interacts. |
| accent | string | "#0071e3" | Ring, dot and button colour. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry
Run this once per project. It writes the Nexus UI entry into
components.jsonfor you:npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"Type it exactly as shown.
{name}is filled in by the CLI with the component you ask for, so you never replace it.
- 3
Add the component
Run this from your project root. It adds the component, the helpers it imports and its npm packages.
npx shadcn@latest add @nexus-labs/radio-cards
- 4
Check what was added
With a project made as in the Quick Start (a
src/folder), these files land in it:components/radio-cards/index.tsradio-cards.tsx - 5
Copying by hand? Skip the registry
Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that
cn()exists. Install the packages:npm install framer-motion
Then show the source and create each file at the path it gives:
- 6
Use it in a page
Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:
// src/app/page.tsx import { RadioCards } from "@/components/radio-cards"; export default function Page() { return ( <main> <RadioCards /> </main> ); }
Like Radio Cards? 301 more are in Pro.
Pro unlocks all 301 Pro components, every template and block, and everything we release next. Radio Cards stays free.
Radio Cards questions
How do I install Radio Cards?
Run `npx shadcn@latest add @nexus-labs/radio-cards`. It is a free component and installs framer-motion.
How do I define the plans and the starting selection?
Pass `options` as `{ id, title, description, meta?, features? }`. `meta` shows on the right, such as a price, and `features` appear as chips on the selected card. `defaultValue` is an option id; without it the second option starts selected.
How do I get the chosen plan?
Pass `onChange`; it receives the option `id` when the user picks one. There is no controlled `value` prop. The Continue button only shows the plan name and has no click handler, so add your own action there.
Are these real radio inputs?
Yes. Each card wraps a visually hidden `input type="radio"` inside a `fieldset` with a screen-reader legend, so grouping and keyboard behavior come from the browser. The focused card gets a visible outline.
How do I change the color or let it demo itself?
`accent` (default "#0071e3") colors the ring, the dot, the feature check marks and the button. `autoplay` is off by default; when on it cycles the options until someone interacts, and it does not call `onChange`.
Does it make sound, and how do I turn it off?
Ticks when you pick a different plan. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.