Skip to content

SIG—14 Signature system

TriageDeck

Decisions at the speed of a gesture: fling the top card toward a decision, or use arrows and buttons — with tallies and an undo that flies the card back.

Live — this one is real

Queue

Fling the top card toward a decision, or use the arrow keys or buttons. Backspace undoes — the card flies back from where it went. Illustrative content.

01 / 05

  • Remove 0
  • Keep 0
  • Escalate 0

Reported as spam · 3

Selling 40% off accounts for your favourite design tools, message me for the link!!

Left arrow: Remove. Right arrow: Keep. Up arrow: Escalate. Backspace undoes.

Usage

tsx
import { TriageDeck } from "mizu-ui";

export function Example() {
  return (
    <TriageDeck
      label="Inbox"
      items={[
        { id: "a", title: "Invoice from Northworks" },
        { id: "b", title: "Team offsite dates" },
      ]}
      itemLabel={(m) => m.title}
      decisions={[
        { id: "archive", label: "Archive", direction: "left" },
        { id: "keep", label: "Keep", direction: "right", tone: "success" },
      ]}
      renderItem={(m) => <h3 style={{ margin: 0, fontSize: 24 }}>{m.title}</h3>}
    />
  );
}

This code, running — no configuration beyond the data

01 / 02

  • Archive 0
  • Keep 0

Invoice from Northworks

Left arrow: Archive. Right arrow: Keep. Backspace undoes.

Keyboard

←→
Decide left or right
↑
Decide up, when offered
BackspaceZ
Undo the last decision

Source & setup

Add this component to your project with the shadcn CLI. The command copies its source and styles into your configured UI directory.

sh
npx shadcn@latest add 0xuser64bit/mizu/triage-deck

For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion.

Inspect signature/TriageDeck.tsx

Source is included in the npm package under src/signature/TriageDeck.tsx.

Open full source ↗

Props

PropTypeDefaultDescription
label / items / renderItemstring / T[] / (item) => ReactNode—Region name, the queue (each with an id) and a card body.
itemLabel(item) => string—A short name used in announcements and the deck's label.
decisionsTriageDecision[]—id, label, direction (left, right or up — one each) and tone.
onDecide / onUndo(item, decision) => void—Record or reverse a decision.
emptyReactNode—Shown when every item has been decided.

Accessibility

The deck is a focusable group named after the current item and its position. Arrow keys make the decisions a fling would; every decision also has a labelled button with its key, and Backspace undoes. Each decision announces what happened and what comes next. Tallies are a labelled list.

Motion

The top card follows your hand and tilts with it; decision stamps fade in as you cross a threshold, and release velocity carries it off. The next card steps forward in depth, and an undone card flies back from the side it left by. Reduced motion decides without flight or tilt.

Works alongside