Deck

A Tinder-like swipeable card stack component with smooth animations.

Installation

npx love-ui@latest add deck

Usage

import { Deck, DeckCards, DeckItem, DeckEmpty } from "@/components/deck"
<Deck>
  <DeckCards>
    {items.map((item) => (
      <DeckItem key={item.id}>
        {item.content}
      </DeckItem>
    ))}
  </DeckCards>
  <DeckEmpty>No more cards</DeckEmpty>
</Deck>

Features

  • Swipe cards left or right with touch or mouse drag
  • Smooth, animated transitions powered by Motion
  • Composable API: pass children as swipeable cards
  • Customizable swipe threshold, stack size, perspective, and scaling
  • Callbacks for swipe and swipe end events
  • Visual stack effect with perspective and scaling
  • Controlled and uncontrolled index support
  • Automatic card progression after swipe

Examples

Controlled Deck