Navigation · block · 27K

Card stack

A stack of cards for case studies and portfolios, in the spirit of late-'80s card-and-background stacks: one card at a time in a shared background with a "3 / 12" counter, card buttons, an arrow palette, #card-id deep links and visual effects (stepped dither dissolve, wipes, iris, barn door) via the View Transitions API.

Cards must be direct children of <CardStack> (fragments are fine). Every card stays in the DOM, hidden unless current. Effects need document.startViewTransition (Chrome, Edge, Safari 18+); elsewhere, under prefers-reduced-motion and in hidden tabs the card swaps instantly. Going backward mirrors wipes and closes the iris and barn door. Keys: ←/→, Home/End, ⌘←/⌘→ (Ctrl elsewhere) inside the stack, or page-wide with keyboard="document". The effect keyframes are injected once with a React 19 hoisted <style href precedence>. The export Card shares a name with shadcn's Card; alias it on import if you use both.

Install

pnpm dlx shadcn@latest add @s7ui/card-stack

Example

This example also uses @s7ui/icons @s7ui/label @s7ui/native-select.

Case studies

Selected work

Four small projects, one card each. Every card has its own link: try reloading with #weather-kiosk in the address bar.

  • Library catalogue
  • Weather kiosk
  • Recipe cards
  • Newsletter

Info

Files:
components/retro/card-stack.tsx, hooks/use-card-stack.ts
Uses:
@s7ui/theme, @s7ui/bitmap, @s7ui/button
Packages:
react-dom