Cnippet

Scroll Progress

Component 4

About

A spring-animated progress bar that tracks scroll position — works for the full page or a scrollable container element.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Scroll Progress to your project and fits it to your theme.

Code

How Scroll Progress is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { useRef } from "react";
import { ScrollProgress } from "@/components/ui/scroll-progress";

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

  return (
    <div className="flex min-h-50 items-center justify-center px-6">
      <div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-card shadow-sm">
        <div className="relative border-border border-b bg-card/80 px-4 py-3">
          <p className="font-semibold text-foreground text-sm">Changelog</p>
          <ScrollProgress
            className="absolute right-0 bottom-0 left-0 h-0.5 bg-gradient-to-r from-violet-500 to-pink-500"
            containerRef={containerRef}
          />
        </div>
        <div
          className="h-48 overflow-y-auto p-4 text-muted-foreground text-sm"
          ref={containerRef}
        >
          {["v1.3", "v1.2", "v1.1", "v1.0"].map((v) => (
            <div className="mb-4" key={v}>
              <p className="mb-1 font-semibold text-foreground">{v}</p>
              <p className="leading-relaxed">
                Added new animated components, improved accessibility, fixed
                scroll-jank in Safari, and bumped peer deps to Motion 12.
              </p>
            </div>
          ))}
        </div>
      </div>
    </div>
  );
}

Dependencies

More by Cnippet

View all
  • Team

    Team

    1.3K
  • Davincho Hero-1

    Davincho Hero-1

    683
  • Aero Hero-3

    Aero Hero-3

    559
  • Features

    Features

    510
  • Random Letter Swap Navigation

    Random Letter Swap Navigation

    487
  • Services with Animated Hover Modal

    Services with Animated Hover Modal

    465
  • Blogs

    Blogs

    396
  • Aero Hero-1

    Aero Hero-1

    356