Toggle Sidebar B
AppearanceLight & dark mode D

Card Swap

Cards animate position swapping with smooth layout transitions.

Default

Every prop is wired to the controls underneath. The front card drops, the rest move up, and it returns to the back of the stack.

Dark previewReplay previewOpen in new tab

Card stacks have never looked so good

Just look at it go!

Smooth

Card Swap Demo 1

Reliable

Card Swap Demo 2

Customizable

Card Swap Demo 3

Customize

Card Distance60
Vertical Distance70
Delay (ms)5000
Skew Amount6
Easing

API Reference

CardSwap

PropTypeDefaultDescription
widthnumber | string500Width of the card container.
heightnumber | string400Height of the card container.
cardDistancenumber60X-axis spacing between cards.
verticalDistancenumber70Y-axis spacing between cards.
delaynumber5000Milliseconds between card swaps.
pauseOnHoverbooleanfalseWhether to pause animation on hover.
skewAmountnumber6Degree of slope for top/bottom edges.
easing'linear' | 'elastic''elastic'Animation easing type.

CardSwapCard

PropTypeDefaultDescription
customClassstring''Extra class added to the card. Put one CardSwapCard per card in the default slot of CardSwap.

Events

PropTypeDefaultDescription
card-click(idx: number) => void-Emitted when a card is clicked, with its index in the slot.

Accessibility

Keyboard shortcuts and ARIA behavior.

  • The swap runs on a timer and pointer hover only. Keep any essential content outside the stack, and turn on pauseOnHover for content people need time to read.