Components / effect

Card Stack

v1.0.0 · premium

A stack of cards. Drag the top one away, or press the arrow keys, and the next card rises into place.

Card Stack demo

Implementation

A stack of cards. Drag the top one away, or press the arrow keys, and the next card rises into place.

Framework
React 19.3.1 with TypeScript
Motion
Native CSS and browser APIs. No GSAP required.
Available modes
build
Version
1.0.0 · published

Source code

Download source ZIP
export function CardStack({ cards, label, threshold = 110, ink, className }: {
  cards: readonly ReactNode[];
  /** Accessible name of the stack, for example "Projects". */

Quality evidence

Export tested in 2 consumer projects with chromium, firefox, webkit. Evidence recorded on .

Changelog

v1.0.0 · A stack of cards. Drag the top one away, or press the arrow keys, and the next card rises into place.

Frequently asked questions

How do visitors move through the stack without dragging?

The stack is focusable and the left and right arrow keys throw the top card. A live region announces the new position.

Can I loop a different number of cards?

Yes. Pass any number of cards. The stack shows the top three and cycles the rest to the back.