Feature Library

Cards on springs

<0.01 CPU ms
A still of the Cards on springs demo
Still
The live demo starts when it’s in view.Drag a swatch and fling it onto a pile · focus one and press ← → or 1–4 · Enter says where it is

Cards that feel like things: each sits on damped springs for its place, turn, squash, paper flutter and lift.

What it costs a frame

<0.01 ms
GPU
not used
CPU, median
<0.01 ms
CPU, 95th pct
<0.01 ms
Draw calls
0
Weight
Light

Measured 13 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged CPU <0.01–<0.01 ms). What ran: Measured with the demo playing by itself: it deals the deck out to the three piles (nine flights, staggered), knocks the table, gathers them back and deals again. Each moving card writes its transform and --crs-lift once a frame; nothing runs while the cards rest. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring toolnot timed<0.01<0.01
apple · Apple A19 Proin a browser tab · 16 November 2026not timed<0.010.02
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026not timed<0.010.01

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
DOM and CSSPlain DOM and CSS: every current browser.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Sorting and grouping boards
  2. Card games and flash cards
  3. Mood boards and photo piles
  4. Playful dashboards whose tiles answer the hand
  5. Giving any draggable tile a physical feel

Pitfalls, in brief

  1. Give the card no background of its own: draw its face in a child.
  2. The module owns the card’s transform (its place in the stack plus its pose).
  3. No z-index, transform, filter or overflow clip on a pile or on anything between the piles and their common box: each makes a stacking context or a clip, and a card flying to another pile is drawn under it or cut off.
  4. Only the top card of a stack takes the pointer and the keys (the rest have data-crs-under and pointer-events: none).
  5. The layout has the card in its new pile at once (DOM order, focus, labels, onMove); only the drawing flies.
4 more in brief
  1. Pile boxes are measured at each move from root’s getBoundingClientRect: a CSS scale on root or an ancestor makes the flights wrong by that factor.
  2. The card sets touch-action: none so a finger can drag it, so the page cannot be scrolled by dragging a card.
  3. Moving a focused card to another pile moves it in the DOM, which blurs it; the module focuses it again (without scrolling).
  4. Strength 0 and reduced motion keep every move (cards change piles at once, a dragged card still follows the pointer) and drop the springs; nothing else changes, so test both.
9 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

WAI-ARIA Authoring Practices Guide (W3C): Each top card is a named button (with a card role description) whose keys are described; moves are said in a polite live region.

springsphysicsflingdragcardsstackssquash and stretchtouchkeyboardlive regionreduced motiondomno dependencies

Near it in the frame