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| Name | Type | Default | Description |
|---|---|---|---|
cards | ReactNode[] | None | The 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. |
visible | number | 4 | How many cards show, counting the top one. The rest wait hidden at the back. |
spread | number | 0.5 | How far the cards behind fan, offset or scatter, from 0 for a neat stack to 1 for a wide one. |
depth | number | 0.5 | How much smaller and darker each card behind gets, from 0 for none to 1 for a strong recede. |
radius | number | 16 | Corner radius of the cards in pixels. |
frame | number | 0 | Width of a border around each card in pixels, like the edge of a printed photo. |
frameColor | string | "#ffffff" | Color of the frame around each card. |
shadow | boolean | true | Gives every card a soft drop shadow. |
tilt | number | 30 | How 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. |
threshold | number | 90 | How far in pixels the top card has to be dragged before it goes to the back. A quick flick works too. |
speed | number | 1 | Speed of every animation, from 0.5 for slow and soft to 2 for fast and snappy. |
sendToBackOnClick | boolean | false | Clicking the top card also sends it to the back. |
autoplay | boolean | false | Cycles through the cards on its own. |
autoplayDelay | number | 3000 | Time in milliseconds between automatic cycles. |
pauseOnHover | boolean | false | Pauses autoplay while the pointer is over the stack. |
onChange | (index: number) => void | None | Called with the index of the new top card whenever the stack moves. |
sensitivity | number | None | Our older name for threshold. When set, it is used as the drag distance instead. |
randomRotation | boolean | false | Gives every card a small random turn on top of the layout. |
className | string | "" | Extra class names for the root element. |
style | CSSProperties | None | Inline styles for the root element. |