Skip to content
IndexRequest a UIAboutContact

Stacked Cards

A compact pile of cards that fans out on hover, focus or tap to show every item.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a stacked-cards component with three notification cards (Payment received, New follower, Update available), each 280x56px with a 13px title and 12px secondary line. At rest the cards overlap: the first is on top at full scale, the second is offset 10px down at scale 0.96 and the third 20px down at scale 0.92, all inside a container 280px wide. Add a small toggle button "Show all" below with aria-expanded. On container hover, :focus-within or when expanded, each card translates down by index times 64px (gap 8px) and scales to 1, with a 300ms cubic-bezier(.2,.7,.2,1) transition and a 40ms transition-delay per index. The container height animates from 76px to 192px. Pressing the toggle expands or collapses and updates its label ("Show all" / "Collapse"). Under prefers-reduced-motion remove the stagger and use a 120ms transition.

About this pattern

Definition

Several cards drawn on top of one another with small offsets. Interacting with the pile spreads them into a readable list, and moving away folds them back.

Purpose & UX principles

  • Saves vertical space when many items of the same kind exist (notifications, tickets, wallet cards).
  • The collapsed pile hints at how many items exist; the expanded list gives full access.
  • A button toggles the stack for keyboard and touch users, and the pile also opens on hover for pointers.

Interaction states

  • Collapsed, expanded (hover, focus-within or toggled), pressed, focus-visible ring on the toggle.
  • aria-expanded mirrors the toggle state.

Motion specification

  • Each card translates by its index: 300ms cubic-bezier(.2,.7,.2,1) with a 40ms stagger.
  • Scale of back cards 0.96 and 0.92 at rest.
  • Reduced motion: the stack expands without staggered movement, using a plain 120ms transition.

Responsive behaviour

  • The stack width follows its container; expanded height grows with the number of items.
  • On touch devices the toggle button is the primary control.

Code

HTML
<div class="wrap">
  <div class="stack" id="stack">
    <article class="n" style="--i:0"><b>Payment received</b><small>$48.00 from Maya</small></article>
    <article class="n" style="--i:1"><b>New follower</b><small>Jon started following you</small></article>
    <article class="n" style="--i:2"><b>Update available</b><small>Version 2.4 is ready</small></article>
  </div>
  <button class="tg" id="tg" aria-expanded="false" aria-controls="stack">Show all</button>
</div>

Related patterns

Expandable Card

↗
Expandable CardCards & Containers

Accordion

↗
AccordionCards & Containers

Hover Reveal Card

↗
Hover Reveal CardCards & Containers