Skip to content
StackD
Bag drop, the StackD component

E-commerce · StackD Pro

Bag drop

A small shop: products in a row of 3D cards and a bag you drag their pictures into. The bag leans toward what you carry and squashes as it lands; the receipt rises out of it and Pay tears off the order pass.

Get StackD Pro · €59/year

Code and Figma for every component, new ones almost every day.

See it in the store ›

Details

Category
E-commerce
Plan
StackD Pro
Code
React + Tailwind, TypeScript · 965 lines
Files
BagDrop.tsx, sounds.ts
Needs
React and Tailwind only
Agents
MCP server and shadcn registry

About

A small shop in one piece: your products in a row of cards in real 3D, and a bag you drop them into. The product in front faces you and the others turn away to either side; drag the row or press a card to bring it forward. Pick a size, then pick the picture up off its tile and carry it to the bag. As it comes near, the bag leans toward it and opens its mouth; let go over it and the picture drops in, the bag squashes and the count pops. Let go anywhere else and it springs back. Add to bag does the same in one press.

Tap the bag and the receipt rises out of it: a row per item with a spongy − / +, a perforation, the total and Pay. Pay, and the stub tears off along the perforation and becomes the order's pass, with its number and a barcode.

Wide (700 px and up) the products and the bag sit side by side; narrower, the bag goes under them. Light and dark, one accent colour kept to the details, soft sounds (off until the user turns them on). Respects reduced motion. React + Tailwind, no other libraries.

Install

Once: add the StackD registry to components.json, with the licence key from your receipt in STACKD_LICENSE_KEY (in .env.local):

"registries": {
  "@stackd": {
    "url": "https://www.stackd.codes/r/{name}.json",
    "headers": { "X-License-Key": "${STACKD_LICENSE_KEY}" }
  }
}

With the shadcn CLI:

npx shadcn@latest add @stackd/bag-drop

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD Bag drop component to this project. Use the StackD MCP server: call get_component with { "name": "bag-drop" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles. It is a paid component: if the server says it needs a licence, tell me where to buy it.

Use

  1. Copy BagDrop.tsx and sounds.ts into the same folder (for example components/).
  2. Use it:
import { BagDrop, type Product } from './components/BagDrop'

const products: Product[] = [
  { id: 'coat', name: 'Quilted coat', price: 235, sizes: ['S', 'M', 'L'], image: '/coat.png', tint: '#EEF0E8' },
  { id: 'scarf', name: 'Wool scarf', price: 54, image: '/scarf.png' },
]

<BagDrop
  products={products}
  width={760}
  onCheckout={async (lines) => {
    const { orderId } = await pay(lines)   // throw and the receipt shakes and stays open
    return orderId                          // shown on the pass
  }}
/>

Transparent pictures (PNG or WebP with no background) look best: they float when you carry them. tint is the tile behind each one.

To add from somewhere else (a product page, a quick-add button), keep a ref: bag.current?.add(product, 'M').

In Next.js the files already start with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
productsfive demo products{ id, name, price, sizes?, image?, tint? }. image is a URL or any element
lines[]What's in the bag to start with: { key, product, size?, qty }
onChangeCalled with the lines whenever the bag changes
onCheckoutCalled with Pay. Return a promise; resolve with an order number to show it on the pass
onSaveCalled when the round heart button is pressed: (product, saved)
shipping0Added to the total. 0 shows "Free"
arrives'Thu, 12 Dec'The arrival shown on the pass
currency, locale'EUR', 'en'How prices are written
accent'#B9CCEC'The one colour: the size you pick, the dots, the count and the pass's band. A soft pastel works best
theme'light''light' or 'dark'
soundtrueSoft sounds from sounds.ts. They only play once the user turns sounds on (sounds.setEnabled(true))
width760From about 700 px the products and the bag sit side by side

Licence

Part of StackD Pro. You can use it in personal and commercial projects. Don't resell or share the component on its own.

Made by StackD · stackd.codes