INFINITYUI
HomeComponentsDocsTemplates
Star

Getting Started

  • Introduction
  • Installation
  • CLI
  • Audit

Navigation

  • Spotlight Navbar
  • Glass DockNEW
  • Animated Tab Bar
  • Circle Menu
  • Magnet Tabs
  • Animated Sidebar
  • Apple Spotlight
  • Page TOC RailNEW

Text

  • Flip Text
  • Glitch Text
  • Liquid Text
  • Flip Fade Text
  • Mask Cursor Effect

Cards

  • Glow Border Card
  • Testimonials Card
  • Interactive Book
  • Trading CardsNEW
  • Hover Image
  • Chain of ThoughtNEW
  • Masonry Grid
  • Image Pile
  • Staggered Grid

Inputs

  • AI InputNEW
  • OTP Input
  • Leave Rating

Buttons

  • Social Flip Button
  • Creepy Button

Loaders

  • Jelly Loader
  • Rolling Ball Scroll
  • Glowing Scroll

Backgrounds

  • Light Lines
  • Perspective Grid
  • Liquid Ocean
  • Eagle Vision
  • Flow Scroll
  • Horizontal Scroll

Overlays

  • PersonaNEW
  • Infinite Moving Cards
  • Masked Avatars
  • Stacked Logos
  • Icon Wheel
  • Pixelated CarouselNEW
  • Pixelated Image Trail
  • Flip Scroll
  • Interactive Folder
  • Animated Folder IconNEW
  • Stack Scroll
  • Rubik Cube
Overlays

Stack Scroll

#scroll#stack#sticky
01

Design System Foundations

Establish your color palette, typography scale, and spacing tokens before writing a single component.

02

Build with Components

Assemble your UI from reusable, accessible building blocks that can be copy-pasted into any project.

03

Animate Everything

Add delight with physics-based animations and transitions that feel natural and responsive.

04

Ship to Production

Deploy with confidence knowing each component has been crafted for performance and accessibility.

originalInfinity original

This component is implemented locally in InfinityUI. A direct Obsidian counterpart was not found during the audit.

Installation

Use the registry command to add the component source, and install any package dependencies if needed.

Infinity Registry

Install the component source into your project with the shadcn CLI.

npx shadcn@latest add https://infinityui-pearl.vercel.app/r/stack-scroll
Package Dependencies

Install the npm packages used by this component source.

npm install framer-motion

Component Code

Copy and paste this code into your component file.

tsx
"use client";

import { useRef } from "react";
import { motion, useScroll, useTransform } from "framer-motion";

interface StackScrollItem {
    title: string;
    description: string;
    gradient: string;
}

interface StackScrollProps {
    items: StackScrollItem[];
}

function StackCard({ item, index, total }: { item: StackScrollItem; index: number; total: number }) {
    const ref = useRef<HTMLDivElement>(null);
    const { scrollYProgress } = useScroll({ target: ref, offset: ["start end", "end start"] });

    const scale = useTransform(scrollYProgress, [0, 0.5, 1], [0.85, 1, 0.9]);
    const y = useTransform(scrollYProgress, [0, 0.5, 1], [60, 0, -20]);
    const opacity = useTransform(scrollYProgress, [0, 0.2, 0.8, 1], [0, 1, 1, 0.3]);

    return (
        <motion.div
            ref={ref}
            style={{ scale, y, opacity, zIndex: index }}
            className={`relative w-full rounded-3xl p-10 border border-white/10 min-h-[260px] flex flex-col justify-between overflow-hidden ${item.gradient}`}
        >
            <div className="absolute inset-0 bg-black/20" />
            <div className="relative">
                <span className="text-xs font-mono text-white/50 uppercase tracking-widest mb-3 block">{String(index + 1).padStart(2, "0")}</span>
                <h3 className="text-white text-2xl font-bold">{item.title}</h3>
                <p className="text-white/60 mt-3 leading-relaxed max-w-lg">{item.description}</p>
            </div>
        </motion.div>
    );
}

export function StackScroll({ items }: StackScrollProps) {
    return (
        <div className="relative flex flex-col gap-6">
            {items.map((item, i) => (
                <StackCard key={i} item={item} index={i} total={items.length} />
            ))}
        </div>
    );
}