Skip to main content

Module card_stack

Module card_stack 

Source
Expand description

Ported from Arc (MIT) © 2026 Elia Kuratli Reference: Arc源码/arc-library/registry/components/card-stack/card-stack.tsx & .module.css

P6 Component #14: card-stack

  • Triage card deck reviewed one card at a time: drag or flick the top card left (Pass) or right (Keep), or use the Pass / Undo / Keep buttons and ArrowLeft / ArrowRight / Backspace / Ctrl+Z shortcuts.
  • Cards behind peek out below the top card (12px per step, 5% narrower per step) and smoothly rise (LIFT = 0.4) while the top card is pulled away.
  • Vertical travel has a 48px free zone followed by rubber-band resistance (STRETCH_Y = 140px).
  • Decision stamps (Keep in success green on left, Pass in muted ink on right) fade in proportionally to horizontal travel (16px..96px).

Structs§

CardStack
Arc CardStack — triage card deck with drag-to-decide stamps, undo, and keyboard shortcuts.
CardStackItem
One card item inside CardStack.

Enums§

CardDecision
Direction of a card decision in CardStack.

Constants§

CARD_STACK_FLICK_PX_S
Release velocity (px/s) that commits a decision on a short flick.
CARD_STACK_FREE_Y
Free vertical travel before rubber-band resistance engages.
CARD_STACK_LIFT
How many stack steps cards behind rise during drag (0.4).
CARD_STACK_LIFT_DISTANCE
Drag distance (px) at which cards behind reach full lift.
CARD_STACK_PEEK_PX
Vertical peek per card behind the top (12px).
CARD_STACK_SHRINK_STEP
Shrink ratio per stack depth step (5%).
CARD_STACK_STRETCH_Y
Maximum rubber-band vertical stretch beyond FREE_Y.
CARD_STACK_VISIBLE
Visible stack depth (card-stack.tsx: VISIBLE = 4).

Functions§

card_stack_resist_y
Vertical rubber-band resistance past CARD_STACK_FREE_Y (card-stack.tsx: resistY).
card_stack_should_commit
Evaluates whether a drag release commits a CardDecision.
card_stack_slot_metrics
Computes (scale, offset_y, opacity) for a card at stack depth depth given top-card lift [0..1].
card_stack_stamp_opacities
Computes (keep_opacity, pass_opacity) stamps from horizontal offset dx.