Calm motion: animations on this site only fade, with no movement
SwipeDeck
Stack of cards to accept, reject or skip, with undo
Go through a pile one card at a time: triage a queue, vet applicants, sort photos. Each card gets a verdict and leaves the deck. For items you arrange rather than judge, use Sortable or Kanban.
Basic
Dark theme for the docs
Already in. Ship a screenshot.
v-modelis the cards still to decide, top first. Each verdict removes the top card. Cards past the third are not rendered, so a long deck stays cheap.- Drag the top card: right to accept, left to reject, up to skip. A stamp fades in as you pass the way, and the card springs back unless you cross
threshold(default 100 px). - Keyboard: focus the deck, → accepts, ← rejects, ↑ skips, Backspace or Ctrl+Z undoes. The arrows keep their physical direction under RTL, like the drag. Each verdict is announced with the number left.
- The buttons under the deck do the same.
:controls="false"hides them.labelsrenames the verdicts ({ accept: "Keep", reject: "Toss" }). decide(item, decision)fires for every verdict andundo(item)when a card comes back. Undo steps back through the whole history, newest first.#card="{ item, index }"draws a card,#emptythe end screen. The component exposesaccept(),reject(),skip()andundo().- Motion respects
prefers-reduced-motion: cards just disappear.
Usage
ts
import { BlessSwipeDeck } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
rowKey | ((item: T) => string | number) | — | |
label | string | "Cards" | |
controls | boolean | true | show the buttons under the deck |
threshold | number | 100 | how far (px) a drag must travel to count |
labels | Partial<Record<"empty" | "undo" | BlessSwipeDecision, string>> | — | |
modelValue | T[] | [] | the cards still to decide, top of the deck first |
Events
| Name | Payload | Description |
|---|---|---|
decide | [item: T, decision: BlessSwipeDecision] | |
undo | [item: T] | |
update:modelValue | [value: T[]] |
Slots
| Name | Scope | Description |
|---|---|---|
card | { item: T; index: number; } | |
empty | — |