# M stacking cards 1

> Feature cards — three feature cards stack as you scroll through the section

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/m-stacking-cards-1).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/m-stacking-cards-1
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/m-stacking-cards-1-light-b7692a570058a13d.png
- Registry item: https://ui.cnippet.dev/r/m-stacking-cards-1.json
- Categories: stacking cards
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/m-stacking-cards-1.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/stacking-cards`

## Files

### `registry/default/motion-variants/m-stacking-cards-1.tsx`

```tsx
"use client";

import { useRef } from "react";
import {
  StackingCardItem,
  StackingCards,
} from "@/registry/default/motion/stacking-cards";

const features = [
  {
    bg: "bg-violet-500/10",
    description: "Optimized for 60fps with zero layout thrashing.",
    icon: "⚡",
    title: "Blazing Fast",
  },
  {
    bg: "bg-emerald-500/10",
    description: "Ships with ARIA attributes and reduced-motion support.",
    icon: "♿",
    title: "Accessible",
  },
  {
    bg: "bg-sky-500/10",
    description: "Stack any content — cards, text, media — whatever you need.",
    icon: "🧩",
    title: "Composable",
  },
];

export default function StackingCardsFeatures() {
  const containerRef = useRef<HTMLDivElement>(null);

  return (
    <div className="relative h-56 overflow-y-auto px-6" ref={containerRef}>
      <StackingCards
        className="mx-auto h-[500px] w-full max-w-sm"
        scaleMultiplier={0.05}
        scrollOptions={{ container: containerRef }}
        totalCards={features.length}
      >
        {features.map((f, i) => (
          <StackingCardItem index={i} key={f.title} topPosition={`${i * 14}px`}>
            <div
              className={`flex h-44 flex-col justify-between rounded-2xl border border-border ${f.bg} p-5`}
            >
              <span className="text-2xl">{f.icon}</span>
              <div>
                <h3 className="font-bold text-foreground">{f.title}</h3>
                <p className="mt-0.5 text-muted-foreground text-xs">
                  {f.description}
                </p>
              </div>
            </div>
          </StackingCardItem>
        ))}
      </StackingCards>
    </div>
  );
}
```
