Browse components
Pin Pile
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/pin-pileFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/pin-pile.json
Usage
import { PinPile } from "@/components/ui/pin-pile";
const box = useRef<HTMLDivElement>(null);
<div ref={box} className="h-[30rem] overflow-y-auto">
<PinPile 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>
</PinPile>
</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. |