Skip to Content
🎉Introducing Pumki UI
ComponentsCard Swap

Card Swap Animation

A 3D animated card stack that cycles through multiple cards with configurable depth, skew, distance, and animation easing.

Pumki UIPumki UI
Card stacks have never looked so goood
Just look at it!
Smooth
Reliable
Customizable

Installation

Usage


1import CardSwap , { Card } from '@/components/pumki-ui/CardSwap';

Wrap multiple <Card> elements inside <CardSwap> to create a rotating stack effect.

1<CardSwap width={300} height={400} cardDistance={50} verticalDistance={60} delay={3000}>
2 <Card customClass="bg-red-500">Card 1</Card>
3 <Card customClass="bg-blue-500">Card 2</Card>
4 <Card customClass="bg-green-500">Card 3</Card>
5</CardSwap>

Props

CardSwap Props

PropTypeDefaultDescription
widthnumber | string500Width of each card in pixels or CSS units.
heightnumber | string400Height of each card in pixels or CSS units.
cardDistancenumber60Horizontal offset distance between cards in the stack.
verticalDistancenumber70Vertical offset distance between cards in the stack.
delaynumber5000Delay in milliseconds between card swaps.
pauseOnHoverbooleanfalsePauses the card swap animation when hovered.
onCardClick(idx: number) => void-Callback triggered when a card is clicked, passing its index.
skewAmountnumber6Skew value applied to cards for perspective effect.
easing”linear” | “elastic""elastic”Animation easing style for swaps.
childrenReactNode-List of <Card> elements to display in the swap animation.

Card Props

PropTypeDefaultDescription
customClassstring-Additional custom class names for the card element.
classNamestring-Optional extra class names passed directly to the card element.
…restHTMLDivElement props-Any other standard div attributes.
Last updated on