cnippet/ui
  1. motion
  2. scroll animations
  3. stacking cards

scroll animations

Stacking Cards

Cards pin to the top and scale down as subsequent cards scroll underneath, creating a layered stacking effect.

Installation

Usage

Anatomy

Good to know

  • totalCards must match the number of StackingCardItems, and each item needs its index (starting at 0).
  • The container needs enough height to scroll through, e.g. h-[300vh] for three cards.
  • Give each card a slightly larger topPosition so the stacked edges stay visible.
  • Cards stick with position: sticky, so no parent between them and the scrolling element may use overflow: hidden.
  • When the user has turned on reduced motion, cards still stack as you scroll but do not scale down.

Props

StackingCards

StackingCardItem

Examples

Feature Cards

Three feature cards stack as you scroll, each pinning to the top while the next slides underneath.

Testimonial Cards

Customer quotes stack on scroll with subtle scaling, ideal for social proof sections.

Process Steps

Numbered steps stack sequentially on scroll, guiding users through a flow one step at a time.