Throw Deck - React Component | Kokonut UI
Throw Deck
A pile of image cards you drag, flick off the top and send under the deck, with arrow keys and a details view.
Install with
npx shadcn@latest add https://kokonutui.com/r/card-stack.json,
then show me how to use it.
Installation
Throw Deck is a free, open-source React component in the Kokonut UI Cards collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/card-stack.tsx, so the code is yours to change.
Or add it by hand: install its packages, then copy the source from above into components/kokonutui/card-stack.tsx.
npm install lucide-react motion
Usage
import CardStack from "@/components/kokonutui/card-stack";
export default function Example() {
return <CardStack />;
}
Props
cardsDeckCard[]Defaultbuilt-in
accentstringDefault"#f97316"
The one accent color, used by the artwork and the primary action.
actionLabelstringDefault"Add to cart"
Label of the primary action in the details view.
onAction(card: DeckCard) => void
onChange(card: DeckCard) => void
Called with the new top card after the deck cycles.
classNamestring
Extra classes for the root element.
DeckCard
idrequiredstring
titlerequiredstring
subtitlerequiredstring
artrequiredReactNode
Artwork shown edge to edge on the card. Inline SVG keeps it portable.
descriptionrequiredstring
specsrequiredDeckSpec[]
pricestring
DeckSpec
labelrequiredstring
valuerequiredstring
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react |
^0.556.0 |
npm, installed by the CLI |
motion |
^12.23.25 |
npm, installed by the CLI |
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.