Skip to content
PixiKit

Card Stack

A stack of cards you can drag, flick or click through: the top card leans in 3D as it is dragged and slides to the back once it passes the threshold.

pixikit.com/docs/components/card-stack

Customize

Layout
Visible4
Spread0.50
Depth0.50
Radius16px
Frame0px
Frame color
Shadow
Tilt30°
Threshold90px
Speed1.00
Send to back on click
Autoplay
Autoplay delay3000ms
Pause on hover
Random rotation

Props

21
NameTypeDefaultDescription
cardsReactNode[]NoneThe cards in the stack, top first. Images fill the card automatically, any other content works too.
layout"fan" | "cascade" | "deck" | "pile""fan"How the cards behind sit. Fan tilts them out from a corner, cascade offsets them diagonally, deck stacks them upward and pile scatters them like loose photos.
visiblenumber4How many cards show, counting the top one. The rest wait hidden at the back.
spreadnumber0.5How far the cards behind fan, offset or scatter, from 0 for a neat stack to 1 for a wide one.
depthnumber0.5How much smaller and darker each card behind gets, from 0 for none to 1 for a strong recede.
radiusnumber16Corner radius of the cards in pixels.
framenumber0Width of a border around each card in pixels, like the edge of a printed photo.
frameColorstring"#ffffff"Color of the frame around each card.
shadowbooleantrueGives every card a soft drop shadow.
tiltnumber30How far the top card leans in 3D while it is dragged, in degrees. It tilts around the point you hold and leans into fast moves. Use 0 to keep it flat.
thresholdnumber90How far in pixels the top card has to be dragged before it goes to the back. A quick flick works too.
speednumber1Speed of every animation, from 0.5 for slow and soft to 2 for fast and snappy.
sendToBackOnClickbooleanfalseClicking the top card also sends it to the back.
autoplaybooleanfalseCycles through the cards on its own.
autoplayDelaynumber3000Time in milliseconds between automatic cycles.
pauseOnHoverbooleanfalsePauses autoplay while the pointer is over the stack.
onChange(index: number) => voidNoneCalled with the index of the new top card whenever the stack moves.
sensitivitynumberNoneOur older name for threshold. When set, it is used as the drag distance instead.
randomRotationbooleanfalseGives every card a small random turn on top of the layout.
classNamestring""Extra class names for the root element.
styleCSSPropertiesNoneInline styles for the root element.

More interaction components in Pro

View all

Related