Browse components
Scroll Stack
Cards pin to the top of a scroll container and pile onto each other, with covered cards shrinking and dimming underneath.
Installation
npx shadcn@latest add @glint-ui/scroll-stackFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glint-ui-seven.vercel.app/r/scroll-stack.json
Usage
import { ScrollStack } from "@/components/ui/scroll-stack";
const box = useRef<HTMLDivElement>(null);
<div ref={box} className="h-[30rem] overflow-y-auto">
<ScrollStack scrollContainerRef={box}>
<div className="h-64 bg-lime-300 p-6">One</div>
<div className="h-64 bg-violet-500 p-6">Two</div>
<div className="h-64 bg-sky-500 p-6">Three</div>
</ScrollStack>
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | One child per card. |
| scrollContainerRef | ReactNode | — | Ref to the scrolling element. Defaults to the window. |
| stackOffset | number | 32 | Where the first card pins, in px from the top. |
| stackGap | number | 18 | Sliver of each earlier card left visible, in px. |
| itemGap | number | 96 | Space between cards before they stack, in px. |
| scaleStep | number | 0.05 | Shrink per card stacked on top. |
| dim | number | 0.45 | Darkness of a covered card. |
| blur | number | 0 | Blur per card on top, in px. |
| itemClassName | ReactNode | — | Classes for every card wrapper. |
| className | string | — | Extra classes for the root element. |