fetaUI
GitHub

Card Stack

A fanned stack of prints. Drag the top card to skip, or open it for specs and Add to cart.

FreeWeb and MobileMotion

Preview

npx shadcn add @fetaui/card-stack
Playground
Rest
Dragging
Details
Low SunPrint 01 · Risograph$48

The last ten minutes of light over the bay, pulled in two inks.

Size
A3
Paper
Cream 120g
Edition
of 50
State
Icons animation
Motion

Installation

Terminal· bash
 npx shadcn add @fetaui/card-stack

Accessibility

  • The top print is a real button named by its title, meta and price. Prints behind it are hidden from screen readers.
  • The arrows are labelled, so nothing needs dragging.
  • The counter is announced politely.

Motion

  • The top print follows the pointer and tilts by x / 20. The cards below move up one step as you drag.
  • Past 30% of its width or at velocity 500 it flings away in 350 ms. Otherwise it springs back.
  • Details scales the print up in 350 ms.
  • With reduced motion, dragging is off and the arrows swap prints in place.

Responsive behavior

  • 448 px on Web and 358 px on Mobile. The stage stays 380 px tall.
  • Details grows the tray to fit, and Add to cart is taller on Mobile.

Performance

  • At most four prints are in the DOM, whatever the length of items.
  • A drag writes straight to the stage through a motion value, so it never re-renders per frame.
  • The swap to a new top print runs before paint, so it never flashes.

Note for AI

Give your coding assistant the Markdown reference instead of screenshots.

  • Import CardStack from @/components/fetaui/card-stack. Without items it shows five sample prints.
  • Each item needs name, meta, price and art. description and specs fill the details view.
  • Add to cart only calls onAdd. Wire it to your cart.
  • The stack wraps at both ends. Past 30% of the card width, or at 500 px/s, a drag skips. Composes Card, Button and Icon Button.

Related