---
title: "Sticky Card Stack"
description: "Cards that pin one after another as you scroll. Each card under the next one shrinks and dims a little, so the stack reads as depth."
url: https://gelatinui.com/components/sticky-card-stack
markdown_url: https://gelatinui.com/components/sticky-card-stack.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/sticky-card-stack"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Sticky Card Stack

> Cards that pin one after another as you scroll. Each card under the next one shrinks and dims a little, so the stack reads as depth.

Page: https://gelatinui.com/components/sticky-card-stack

## When to use it

Best for: A short list of cards (three to six) that pile up as the page scrolls.

- Put each card in a `StickyCardStackItem`. The item adds no surface: put a `Card` or your own box inside.
- Set where the first card pins with `offset` (px from the top, 80 by default for a header) and how much of each card stays in sight with `peek`.
- Give the root room below the last card (bottom padding), so the stack has scroll to pin in.
- In a scroll box, pass the box as `container`.

## When not to use it

- For cards that a reader swipes through side by side, use [Carousel](https://gelatinui.com/components/carousel.md).
- For cards that turn toward the pointer, use [Tilt](https://gelatinui.com/components/tilt.md).

## Notes for agents

- The browser pins the items (`position: sticky`), so the pin never lags. Item i pins at `offset + i × peek` px.
- Each item finds its index from its place among the items, so items map from data with no index prop.
- A card under the next one scales down by `shrink` and dims by `dim` for each card on top, up to three cards.
- The dim layer takes the item corner (`rounded-xl`, the Card corner). Set another corner on the item with `className`.
- A focus in a covered card scrolls the page (or the `container`) back to where that card pins, so the focused control shows.
- `disabled` keeps the pin but stops the shrink, the dim, and the rect reads.
- It reads rects only while the stack is on screen, and moves with `transform` and `opacity` only.

## Anatomy

```text
StickyCardStack
└─ StickyCardStackItem (0..n)
```

## API reference

### StickyCardStack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `offset` | `number` | 80 | The px from the top of the view where the first card pins. Default 80 (under a header). |
| `peek` | `number` | 12 | The px of each card that stays in sight under the next one. Default 12. |
| `shrink` | `number` | 0.05 | How much smaller a card gets for each card on top of it: 0.05 is 5%. Default 0.05. |
| `dim` | `number` | 0.15 | How much a card dims for each card on top of it, from 0 to 1. Default 0.15. |
| `disabled` | `boolean` | false | The cards still pin, but never shrink or dim, and the rect work stops. |
| `container` | `RefObject<HTMLElement \| null>` |  | The scroll box, when the stack scrolls inside one and not with the page. |

### StickyCardStackItem

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| StickyCardStack | `sticky-card-stack` |  |  |  |
| StickyCardStackItem | `sticky-card-stack-item` |  | `--sticky-card-stack-index`, `--sticky-card-stack-offset`, `--sticky-card-stack-peek` |  |

## Usage

Put one card in each item, and give the stack room below the last card.

The sample also uses `card`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/sticky-card-stack @gelatin-ui/card
```

```tsx title="how-it-works.tsx"
import { StickyCardStack, StickyCardStackItem } from "@/components/pro/cards/sticky-card-stack";
import { Card, CardHeader, CardTitle } from "@/components/ui/card";

const steps = ["Pick your dates", "Choose a route", "Pack and go"];

export function HowItWorks() {
  return (
    <StickyCardStack className="mx-auto max-w-lg pb-[50vh]">
      {steps.map((step) => (
        <StickyCardStackItem key={step}>
          <Card className="min-h-56">
            <CardHeader>
              <CardTitle>{step}</CardTitle>
            </CardHeader>
          </Card>
        </StickyCardStackItem>
      ))}
    </StickyCardStack>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/sticky-card-stack
```

It adds 22 registry items: 21 files, 3765 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Parallax](https://gelatinui.com/components/parallax.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Card](https://gelatinui.com/components/card.md)
- [Parallax](https://gelatinui.com/components/parallax.md)
- [Tilt](https://gelatinui.com/components/tilt.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | A focus in a covered card scrolls back to where that card pins, so the focused control shows. |

## Accessibility

The cards keep their reading order. The dim layer is `aria-hidden` and takes no clicks.

## Motion

| Part | Motion |
| --- | --- |
| Scroll | none · the scale and the dim of each card follow the scroll in the same frame, with no easing |
