Skip to content

    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.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/pin-pile

    First 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

    PropTypeDefaultDescription
    childrenReactNode—One child per card.
    scrollContainerRefReactNode—Ref to the scrolling element. Defaults to the window.
    stackOffsetnumber32Where the first card pins, in px from the top.
    stackGapnumber18Sliver of each earlier card left visible, in px.
    itemGapnumber96Space between cards before they stack, in px.
    scaleStepnumber0.05Shrink per card stacked on top.
    dimnumber0.45Darkness of a covered card.
    blurnumber0Blur per card on top, in px.
    itemClassNameReactNode—Classes for every card wrapper.
    classNamestring—Extra classes for the root element.