Swipe Deck
Markup where the component goes, CSS in your stylesheet, script before </body>. In Vue, Svelte or Angular, call initCardSwipeDeck(el) on the mounted element instead.
Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Install with shadcn
Needs a free account token. Get a token
npx shadcn@latest add @movin/card-swipe-deckAbout this component
A deck of cards you fling. Drag the top card and it tilts with the throw while a Keep or Skip stamp fades in by direction; let go far enough and it flies off and tucks in at the back of the deck as the next card rises. Arrow keys swipe too.
Triggers
- Click
- Spring
- Card
- Mouse tracking
Techniques
- CSS variables
- Event position
- Spring
- State machine
Difficulty
Intermediate
Accessibility
Keyboard and screen readers
The deck is a focusable group: Left and Right arrows swipe the top card. Cards below the top are aria-hidden.
Reduced motion
Cards move without animation.
Use it in anything you build, commercial and client work included. Licence