Wallet Stack, animated React component
- Pro
- Cards
- Hover
- Spring
- 3D
Payment cards tucked into a leather wallet, each peeking out a little higher than the one in front. Picking a card slides it out while the others sink, then turns it over in 3D to show the back; picking it again puts it away.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| cards | WalletCard[] | DEFAULT_WALLET_CARDS | Cards from back to front, each { id, name, last, bg, ink, brand, expires? }. Four fit best. |
| label | string | "Wallet" | Word stamped on the wallet; also the group's accessible name. |
| hint | string | "Pick a card." | Hint under the wallet. An empty string hides it. |
| onSelect | (id: string | null) => void | — | Called with the card id when one slides out, and null when it is put back. |
| autoplay | boolean | false | Takes each card out, flips it and puts it back in turn until someone touches it. |
| className | string | — | Extra classes for the root. |
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 with your API key
Wallet Stack is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Wallet Stack works
Cards tucked into a leather wallet, each peeking out a little higher than pocket, the rest sink, and it turns over to show the back. Pick it again to put it away.
The source, the install command and the build prompt come with Pro.
Wallet Stack questions
How do I install the Wallet Stack?
Run `npx shadcn@latest add @nexus-labs/wallet-stack`. It installs framer-motion, and the component is a client component ("use client"). It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I add my own cards?
Pass `cards` as `{ id, name, last, bg, ink, brand, expires? }[]`, ordered from back to front, where `bg` is any CSS background such as a gradient and `last` is the last four digits. About four cards fit best, and `expires` defaults to "08/28".
How do I know which card the user picked?
`onSelect` is called with the card `id` when it slides out and with `null` when it is put back. `label` (default "Wallet") is stamped on the wallet, and `hint` (default "Pick a card.") is the caption under it, which an empty string hides.
How is the card flip built, and is it accessible?
Each card is a Framer Motion button with `perspective` on the container and a spring on `rotateY`, with `backface-visibility` hidden on both faces, so it is pure CSS 3D with no canvas. Cards are real buttons with `aria-pressed` and a label like "Name card ending 1234", so Tab and Enter work.

