Skip to content
English
Index card stack comes with Pro. Its preview shows once you unlock it.

How it works

Folder i sits one step lower than the folder behind it and 6px wider on each side, so the stack reads as stairs, and its tab steps from left to right across the width. Each folder is three layers: the tab (part of the back), the index card, and the front panel, so a card rises from between them, in front of the folders behind and behind the ones in front. Opening slides the card up by its height less 14px on a 600ms spring with a small overshoot; the folders in front dip 10px and the header fades. Closing slides it back in 360ms. Pointing at a folder or focusing its tab lifts it 6px. Folders further back are a shade deeper. While a card is out its own tab is behind it, so the tab's focus ring is drawn around the card.

Use it for

  • Testimonials or reviews on a landing page, one at a time.
  • A recipe box, study cards or notes grouped by section.
  • Any short set of sections where each has one card worth of content.

Look elsewhere when

  • More than about eight sections: the tabs get too small; use tabs or a list.
  • Long content: a card shows about 130px; link to the full page instead.
  • Comparing several sections side by side: only one card is out at a time.

Usage

import { useState } from 'react'
import { IndexCardStack } from './IndexCardStack.jsx'

export function Reviews({ reviews }) {
  const [open, setOpen] = useState(null)
  return (
    <IndexCardStack
      label="Customer reviews"
      items={reviews.map((r) => ({
        id: r.id,
        tab: r.company,
        content: (
          <figure>
            <blockquote>{r.quote}</blockquote>
            <figcaption>{r.author}, {r.role}</figcaption>
          </figure>
        ),
      }))}
      value={open}
      onValueChange={setOpen}
      header={<h3>What teams say</h3>}
      footer={`Reviews · ${reviews.length}`}
      cardHeight={170}
    />
  )
}

Props

PropTypeDefaultWhat it does
items{ id, tab, content }[]—The folders from back to front: the tab label and the content of its card. Five to eight read best.
valueid | null—The id of the card that is out (controlled), or null for none.
defaultValueid | nullnullThe card out at first when uncontrolled.
onValueChange(id | null) => void—Called when a tab, a press on the card or Escape takes a card out or puts it back.
headerReactNode—Shown in the headroom above the folders; it fades away while a card is out.
footerReactNode—Text on the front of the box, such as a count.
stepnumber26Vertical step between folders in pixels.
cardHeightnumber150Height of each card; the headroom above the folders follows, so the back card has room to rise.
labelstring—Accessible name of the group.
...restHTMLAttributes—Other attributes go to the root element.

Accessibility

  • Each tab is a native button with aria-expanded and aria-controls pointing at its card, which is a region labelled by the tab.
  • Tabs use a roving tab stop: Up, Down, Left and Right move between them, Home and End jump to the ends, Enter or Space opens or closes, Escape puts the card back.
  • Cards that are tucked away are inert, so neither the keyboard nor a screen reader reaches their content.
  • Pressing the card (outside its own links and buttons) or a folder's front panel also toggles it, for pointer and touch.
  • Tab labels are 13px and end in an ellipsis when long; card text is at least 12px.
  • Reduced motion moves cards and folders to their places at once, without sliding, springing or dipping.

Motion

Card out: 600ms spring with a slight overshoot. Card back: 360ms ease-in-out. Folders in front dip 10px and lifted folders rise 6px, 360ms ease-out. Header fades in 240ms.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

IndexCardStack.jsxindex-card-stack.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Lists & layout
Arc carousel comes with Pro. Its preview shows once you unlock it.
Cylinder carousel comes with Pro. Its preview shows once you unlock it.