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+Zshortcuts. - Cards behind peek out below the top card (
12pxper step,5%narrower per step) and smoothly rise (LIFT = 0.4) while the top card is pulled away. - Vertical travel has a
48pxfree zone followed by rubber-band resistance (STRETCH_Y = 140px). - Decision stamps (
Keepin success green on left,Passin muted ink on right) fade in proportionally to horizontal travel (16px..96px).
Structs§
- Card
Stack - Arc
CardStack— triage card deck with drag-to-decide stamps, undo, and keyboard shortcuts. - Card
Stack Item - One card item inside
CardStack.
Enums§
- Card
Decision - 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 depthdepthgiven top-cardlift[0..1]. - card_
stack_ stamp_ opacities - Computes
(keep_opacity, pass_opacity)stamps from horizontal offsetdx.