Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Scroll Progress Bar, animated React component

A progress rail for long reads: the fill springs after your scroll, a bead rides its tip and stretches with your speed, and each milestone dot pops in as you pass it. It tracks the page, a section or a scrollable panel, runs vertical or horizontal, and optional chapter labels jump to their part of the page.

  • Free
  • Motion Effects
  • Scroll
  • Spring

Like Scroll Progress Bar? 301 more are in Pro.

Pro unlocks all 301 Pro components, every template and block, and everything we release next. Scroll Progress Bar stays free.

Props

PropTypeDefaultWhat it does
targetRef—Section whose trip through the viewport drives the fill. Omit it to track the page or containerRef.
containerRef—Scrollable parent, when the bar tracks a panel rather than the document.
progress—Your own 0..1 progress. Overrides scroll tracking.
orientation"vertical"Rail direction.
height206 (vertical) / 4 (horizontal)Vertical: rail length. Horizontal: rail thickness.
width4 (vertical) / "100%" (horizontal)Vertical: rail thickness. Horizontal: rail length.
fillColor#0071e3 (#0a84ff dark)Fill, bead and marker colour.
backgroundColor#e8e8ed (#3a3a3c dark)Track colour.
markerCount4Milestone dots spread evenly along the rail, ends included.
markerSize10Milestone dot diameter in px.
showMarkerstrueShow the milestone dots.
labels—One label per milestone. Labels become buttons that scroll to their chapter.
showHeadtrueDraw the bead that rides the tip of the fill.
stiffness150Spring stiffness for the fill.
damping26Spring damping for the fill.
onSeek—Called with the target progress when a label is clicked, before it scrolls there.
autoplayfalseGently scrolls containerRef (or plays the fill by itself) until someone scrolls, clicks or presses a key.
ariaLabel"Section scroll progress"Accessible name of the progressbar.
className—Extra classes on the wrapper.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry

    Run this once per project. It writes the Nexus UI entry into components.json for you:

    npx shadcn@latest registry add "@nexus-labs=https://www.nexus-ui.com/api/registry/{name}"

    Type it exactly as shown. {name} is filled in by the CLI with the component you ask for, so you never replace it.

  1. 3

    Add the component

    Run this from your project root. It adds the component, the helpers it imports and its npm packages.

    npx shadcn@latest add @nexus-labs/scroll-progress-bar
  2. 4

    Check what was added

    With a project made as in the Quick Start (a src/ folder), these files land in it:

    components/
    scroll-progress-bar/
    index.ts
    scroll-progress-bar.tsx
  3. 5

    Copying by hand? Skip the registry

    Instead of steps 2 and 3 you can copy the files yourself, with no registry and no API key. Step 1 still applies, so that cn() exists. Install the packages:

    npm install framer-motion

    Then show the source and create each file at the path it gives:

  4. 6

    Use it in a page

    Installing only adds the files. Import the component in a page and render it. The Usage tab on the preview shows a fuller example with props:

    // src/app/page.tsx
    import { ScrollProgressBar } from "@/components/scroll-progress-bar";
    
    export default function Page() {
      return (
        <main>
          <ScrollProgressBar />
        </main>
      );
    }

Like Scroll Progress Bar? 301 more are in Pro.

Pro unlocks all 301 Pro components, every template and block, and everything we release next. Scroll Progress Bar stays free.

About Scroll Progress Bar

Scroll Progress Bar is a slender vertical progress rail for long-form page sections. It listens to a target section or scrollable container with Framer Motion scroll values, then smooths the fill movement through spring physics. Colors and dimensions are configurable, making it useful as a restrained orientation cue beside editorial narratives, feature walkthroughs, and case studies.

Good for

  • Long-form feature walkthroughs
  • Case study and portfolio narratives
  • Documentation chapter indicators
  • Scroll-linked product story sections

Scroll Progress Bar questions

How do I track one section instead of the whole page?

Pass that section's ref as `targetRef`. Add `containerRef` if the section scrolls inside its own container, or pass your own `progress` motion value.

Can I use it as a horizontal bar at the top of the page?

It is built as a vertical rail that fills from top to bottom. For a horizontal top bar, change the fill from `scaleY` to `scaleX` and swap the `height` and `width` values.

How do the markers work?

`markerCount` (default 4) places evenly spaced dots on the rail, and each one switches to the fill color as progress passes it. Hide them with `showMarkers={false}`.

Is it accessible?

It renders with role="progressbar" and an `ariaLabel` you can change. With reduced motion, it follows the scroll directly without the spring.

Guides