Decision queue worked one card at a time: lean the card toward Approve or Reject, it flies off as a ball into the count pill.
DragDrag
Expense approvals
Week 42 · 7 waiting
Rejected11012345678912
M
Taxi to airport
Mara Lindqvist · Oct 14
€34€3012345678940123456789€34
Travel
←RejectApprove→
T
Team lunch
Tomas Brandt · Oct 14
€118€101234567891012345678980123456789€118
Meals
←RejectApprove→
N
Hotel, 2 nights
Noor Haddad · Oct 15
€312€301234567891012345678920123456789€312
Travel
←RejectApprove→
Approved44012345678912
triage-stack · , lively
triage-stack-demo.tsx
When to use
Use it for queues of decisions taken one item at a time. Drag or flick the card, hold an arrow key or press a button; skip sends it to the back and Undo brings it back.
Queues of decisions worked one item at a time: expense approvals, content moderation, applicant screening, duplicate merges, inbox triage. Instead of a table with Approve and Reject buttons on every row, the current item is a card in your hand: drag it toward a side (or hold ArrowRight / ArrowLeft, or press a decision button) and it lifts and leans while the decision ball on that side grows and the card's rim takes the decision's tone. Let go past 40% of the card's width, or flick it, and a copy of the card flies off, contracting into a ball that drops into the count pill, which kicks while the count rolls. The next card rises from the stack. Released short, the card springs back to the centre. Undo pops the ball out of the pill and expands it back into the card. For bulk decisions on many rows at once, use a table with the Selection Bar instead.
Each item has an id, a title and optional meta, amount (formatted with format), tags (strings render as muted chips, nodes as they are: a StatusBadge), a leading slot (an avatar) and content shown when the card is expanded. renderCard replaces the card's body and keeps the chrome, the drag and the flight. value / defaultValue hold the decisions by id (approved, rejected, skipped); a skipped item goes to the back of the queue. decisions renames the two sides ({ left: { id, label, done, tone }, right: … }, tones destructive and success). actionsRef gives decide(decision) and undo(), which play the whole trip as a person would (onboarding, demos).
preset picks the layout: stack (the stack centred between the two decision balls with their count pills, buttons under it), split (the queue list beside the card; the ball lands in the decided row's dot) and compact (one 72 px row with the decision balls at its ends, for dashboard widgets). Below 520 px of container width the stack balls move into the buttons and the count pills into a header row. temperament changes how much it moves, never how it looks.
Flagged posts on the left, the one in hand on the right, with Keep and Remove as the decisions. The current post is highlighted in the list by a pill; the flying ball lands in the post's dot, which kicks.
DragDrag
Flagged posts
Community · reported this week
Removed00012345678962201234567896 of 6Kept1101234567896
TriageStack (data-slot="triage-stack"): the root group, labelled "Approval queue, 3 of 12", with the polite live region.
Top card (data-slot="triage-card"): an article you drag or focus; the two behind it (triage-card-behind) are offset 8 and 16 px and scaled to 0.96 and 0.92.
Decision balls (triage-ball) and count pills (triage-count): decorative, aria-hidden; the count is read by its Roll.
The top card is focusable (tabIndex 0, aria-roledescription="card", named by its title and amount) with aria-keyshortcuts; the cards behind it are hidden from assistive tech.
The buttons are the accessible path and the touch path: each is named with the item, e.g. "Approve: Taxi to airport, €34". The label buttons are 36 px tall; the side balls are 56 px, and in compact every button (decision balls, Skip, Undo) is at least a 44 px touch target.
A polite live region announces each decision and what is left: "Approved: Taxi to airport. 9 left".
After a keyboard decision focus moves to the card that is now on top, with its ring visible while the copy flies; when the queue is empty it moves to the empty state.
Tones are never the only cue: every side has its label (and a check or cross glyph). Rim tints are box-shadow, never a border. success ships in the item's cssVars with the MotionKit values.
No lean, no flight, no kick: the decided card fades out where it is, the next one fades in, and the counts crossfade, all in the 120 ms fade. Dragging still moves the card with the pointer. Depth, rim tints and the decision balls' fill stay.
Nothing runs at rest. A drag writes two motion values per pointer move (offset and charge); the lean eases on a spring. A decision measures two boxes once (the slot and the socket it lands in, after the state is applied) and animates transforms and opacity only: the copy is scaled, its corners and rim are counter-scaled so they stay crisp, and its text is clipped, never scaled. The flight, the reflow of the stack and the count roll share the temperament's spring and stop when settled. Third-party code: motion only.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, motion.
Dependencies
motion · peer
Triggers
drag, click, press
Reduced motion
No lean, flight or kick: the decided card fades out in place, the next fades in and the counts crossfade, all in the 120ms fade; dragging still moves the card.
Keyboard
ArrowRight (hold, release)
Charges the card toward the right decision (Approve); releasing the key decides
ArrowLeft (hold, release)
Charges the card toward the left decision (Reject); releasing the key decides
ArrowDown
Skips: the card goes to the back of the queue
Backspace
Undoes the last decision: the card comes back on top
Space / Enter
On the card: expands or collapses its details. On a button: charges, then decides
Tab / Shift + Tab
Moves between the card and the Reject, Skip, Approve and Undo buttons
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)