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.
Installation
npx shadcn@latest add @kokonutui/card-stack
Props
| Prop |
Type |
Default |
Description |
cards? |
DeckCard[] |
built-in |
|
accent? |
string |
"#f97316" |
The one accent color, used by the artwork and the primary action. |
actionLabel? |
string |
"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. |
className? |
string |
|
Extra classes for the root element. |
DeckCard
| Field |
Type |
Description |
id |
string |
|
title |
string |
|
subtitle |
string |
|
art |
ReactNode |
Artwork shown edge to edge on the card. Inline SVG keeps it portable. |
description |
string |
|
specs |
DeckSpec[] |
|
price? |
string |
|
DeckSpec
| Field |
Type |
Description |
label |
string |
|
value |
string |
|
Source
"use client";
export interface DeckSpec {
label: string;
value: string;
}
export interface DeckCard {
id: string;
title: string;
subtitle: string;
art: ReactNode;
description: string;
specs: DeckSpec[];
price?: string;
}
export interface CardStackProps {
cards?: DeckCard[];
accent?: string;
actionLabel?: string;
onAction?: (card: DeckCard) => void;
onChange?: (card: DeckCard) => void;
className?: string;
}
const DEFAULT_CARDS: DeckCard[] = [
{
id: "low-sun",
title: "Low Sun",
subtitle: "Print 01 · Risograph",
art: <LowSunArt />,
description:
"The last ten minutes of light over open water, pulled in two passes on warm cream stock.",
specs: [
{ label: "Size", value: "A3" },
{ label: "Paper", value: "Cream 120g" },
{ label: "Edition", value: "of 50" },
],
price: "$48",
},
{
id: "ridge-line",
title: "Ridge Line",
subtitle: "Print 02 · Screen print",
art: <RidgeArt />,
description:
"Two ranges, one sun. Hand-pulled in three layers, with a slight misregister on purpose.",
specs: [
{ label: "Size", value: "50 × 70" },
{ label: "Paper", value: "Natural 300g" },
{ label: "Edition", value: "of 30" },
],
price: "$72",
},
{
id: "tide-pools",
title: "Tide Pools",
subtitle: "Print 03 · Risograph",
art: <TideArt />,
description:
"Rings left by a single stone, printed as eight hairlines around one accent dot.",
specs: [
{ label: "Size", value: "A3" },
{ label: "Paper", value: "White 120g" },
{ label: "Edition", value: "of 80" },
],
price: "$40",
},
{
id: "night-market",
title: "Night Market",
subtitle: "Print 04 · Giclée",
art: <NightArt />,
description:
"A block of windows after closing time. Three are still lit; the rest have gone home.",
specs: [
{ label: "Size", value: "40 × 50" },
{ label: "Paper", value: "Cotton 310g" },
{ label: "Edition", value: "Open" },
],
price: "$56",
},
{
id: "salt-flats",
title: "Salt Flats",
subtitle: "Print 05 · Screen print",
art: <SaltArt />,
description:
"One marker post and its shadow across a dry lake bed. Mostly empty, which is the point.",
specs: [
{ label: "Size", value: "50 × 70" },
{ label: "Paper", value: "Bright 300g" },
{ label: "Edition", value: "of 25" },
],
price: "$64",
},
];