ThatDesignUIOriginalInteractive preview
Swipe deck
A layered deck of cards: drag or flick the front card away, or use the buttons and arrow keys, and the next card rises into place.
- Category
- Sliders
- Platform
- Responsive
- Colorful
- Interactive
- Animated
- Touch friendly
Interactive componentClick through it, resize it, or switch states. It’s real UI, not a screenshot.
Use this component
Free to use. It works on its own in any React and Tailwind project, so you can add it with one command, paste the code, or hand the prompt to your coding agent.
FreeReact 18+Tailwind v3.4 or v4No extra packages
1. Add it with the shadcn CLI
npx shadcn@latest add https://www.thatdesignui.com/r/card-stack.json2. Use it
Every prop is optionalapp/page.tsx
import CardStack from "@/components/card-stack";
export default function Page() {
return <CardStack />;
}Prefer to paste it yourself? Open the .
Under the hood
How it’s built
What’s inside
- A 22rem-wide portrait deck of rounded (28px) gradient cards with a noise texture. The next two cards peek out below the front card, slightly smaller and lower.
- The front card follows the pointer and tilts up to 14 degrees as it is dragged. A quick flick or a pull past about 110px sends it off screen; otherwise it springs back.
- Below the deck: a Back button, an 'n of total' counter and a Next button, plus a small hint line.
- Each card has an index, a floating glass illustration, a tag pill, a title and a sentence.
- The deck loops forever. Only the front card is exposed to assistive technology.
How it behaves
- Dragging the front card sideways moves and tilts it; releasing past the threshold advances to the next card, releasing early snaps it back.
- The Next button and the Right arrow key advance; Left arrow flings left; Back returns to the previous card.
- The counter always reads the current position, for example '2 of 5'.
- Touch dragging works and does not block vertical page scroll.
- With reduced motion the transitions are minimal.



