# Scroll Progress

> React scroll progress indicator with a thin top bar and a circular percent ring, spring smoothed, tracking the window or any scroll container you pass.

- Kind: Motion component (Motion)
- Docs: https://ui.minidev.pro/docs/scroll-progress
- Source (registry JSON with the full file): https://ui.minidev.pro/r/scroll-progress.json
- License: MIT. One file, yours to edit after install.

## When to use

Use it on long articles, docs and changelogs. Reach for ScrollProgressRail for a sticky rail with section labels, and the free Progress for task progress that is not tied to scrolling.

## Installation

### shadcn CLI (copies the source into your project)

```bash
npx shadcn@latest add @minidev/scroll-progress
```

Writes `components/ui/scroll-progress.tsx` and installs its npm dependencies. Older CLI versions: `npx shadcn@latest add https://ui.minidev.pro/r/scroll-progress.json`.

### npm package

```bash
npm i minidev-ui-kit motion
```

Add the tokens to your global stylesheet once:

```css
@import "tailwindcss";
@import "minidev-ui-kit/styles.css";
@source "../node_modules/minidev-ui-kit";
```

Next.js also needs `transpilePackages: ["minidev-ui-kit"]` in next.config.

## Import

After the shadcn install:

```tsx
import { ScrollProgress } from "@/components/ui/scroll-progress"
```

From the npm package:

```tsx
import { ScrollProgress } from "minidev-ui-kit/premium/scroll-progress"
```

## Usage

```tsx
import { ScrollProgress } from "@/components/ui/scroll-progress"

export function Example() {
  return (
    <ScrollProgress />
  )
}
```

## Props

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `variant` | `"bar" \| "circle" \| "both"` | `"both"` | no | Which indicators to show. |
| `container` | `React.RefObject<HTMLElement \| null>` | - | no | A scrollable element to track instead of the window. The indicators render where you put them, inside a `relative` wrapper. |
| `fixed` | `boolean` | `false` | no | Pin the indicators to the viewport and track the page (or `container`). Nothing else renders. |
| `height` | `number` | `3` | no | Bar thickness in pixels. |
| `size` | `number` | `40` | no | Ring diameter in pixels. |
| `children` | `React.ReactNode` | - | no | Without `fixed` or `container`, the component scrolls this content in its own panel. |
| `title` | `React.ReactNode` | `"What is new in Lumen 3.0"` | no | Panel header title. |
| `subtitle` | `React.ReactNode` | `"Release notes · 4 min read"` | no | Panel header line under the title. |
| `className` | `string` | - | no |  |

## Examples

### Bar only

variant="bar" drops the ring; height is the bar thickness and children are the content the panel scrolls.

```tsx
<ScrollProgress variant="bar" height={4} title="Northwind onboarding handbook" subtitle="Internal · 6 min read">
  <div className="max-w-prose space-y-4 text-sm leading-[1.7] text-fg-muted">
    <p className="text-fg">Welcome to Northwind. This handbook covers your first two weeks: who to meet, which tools to set up, and how we run finance on Lumen.</p>
    <p>Day one is accounts. Maya Chen will invite you to the Lumen workspace, the shared inbox and the payouts calendar. Accept all three before lunch so approvals can route to you from day two.</p>
    <p>Invoices go out from Lumen only. Never send a PDF by hand; the reminders, the bank matching and the audit trail all depend on the invoice living in one place.</p>
    <p>Approvals are by amount. Anything under 5,000 routes to Priya Raman, larger spends wait for Sam Lowe. If you are unsure, add a note and let it route; nobody minds a question in the thread.</p>
    <p>Payouts run on Fridays. The batch is reviewed on Thursday afternoon, so get supplier details in by Wednesday. Lumen files the remittance advice for you.</p>
    <p>Month end should feel uneventful. If you find yourself exporting to a spreadsheet, stop and ask Theo Okafor; there is almost always a report for it already.</p>
  </div>
</ScrollProgress>
```

### Ring only

variant="circle" keeps just the ring in the header; size is its diameter and the percent text scales with it.

```tsx
<ScrollProgress variant="circle" size={48} title="Terms of service" subtitle="Updated 1 October 2026">
  <div className="max-w-prose space-y-4 text-sm leading-[1.7] text-fg-muted">
    <p className="text-fg">These terms govern your use of Lumen. By creating a workspace you agree to them on behalf of your company.</p>
    <p>Your data stays yours. Lumen stores invoices, customers and bank transactions to provide the service and never sells or shares them with third parties for marketing.</p>
    <p>Payments are processed by regulated partners. Lumen never holds your funds; payouts move directly between your bank and your supplier.</p>
    <p>Plans are billed monthly or yearly per seat. You can cancel at any time and keep read access to your records for twelve months after the last invoice.</p>
    <p>Uptime is targeted at 99.95 percent each month. Planned maintenance is announced seven days ahead on the status page.</p>
    <p>Questions about these terms go to legal@lumen.app. We answer within two working days.</p>
  </div>
</ScrollProgress>
```

### Tracking your own scroller

Pass a ref to any scrollable element as container; the indicators render inside a relative wrapper of your own.

```tsx
function OwnScrollerDemo() {
  const ref = React.useRef<HTMLDivElement>(null)
  return (
    <div className="relative w-full max-w-md overflow-hidden rounded-xl border border-border bg-surface shadow-raised">
      <div ref={ref} className="h-64 overflow-y-auto p-5" tabIndex={0} aria-label="Activity">
        <p className="text-sm font-medium text-fg">Activity</p>
        <ul className="mt-3 space-y-3 text-sm text-fg-muted">
          <li>Maya Chen paid INV-2041, $1,840</li>
          <li>Reminder sent for INV-2038 to Theo Okafor</li>
          <li>Priya Raman approved a $4,200 payout</li>
          <li>Sam Lowe added Atlas Freight as a customer</li>
          <li>INV-2042 opened by Cadence Labs</li>
          <li>Bank feed matched 14 transactions</li>
          <li>Maya Chen exported the Q3 ledger</li>
          <li>Theo Okafor viewed INV-2038 again</li>
          <li>Payout batch of 40 scheduled for Friday</li>
          <li>Priya Raman changed the approval limit to 5,000</li>
          <li>INV-2043 sent to Forma Studio, $980</li>
          <li>Month end closed with nothing left to review</li>
        </ul>
      </div>
      <ScrollProgress container={ref} variant="both" height={3} size={32} />
    </div>
  )
}
```

## Accessibility

- The ring is a `role="progressbar"` named "Reading progress" with `aria-valuenow` from 0 to 100. When only the bar is shown, the bar carries that role instead; otherwise it is `aria-hidden`.
- The built-in panel's scroller has `tabIndex={0}`, so keyboard users can scroll it. It is named by the header `title` through `aria-labelledby`.

## FAQ

### How do I show reading progress for the whole page?

Render `<ScrollProgress fixed variant="bar" />` once. It pins a bar to the top of the viewport (and, with `variant="both"`, a ring in the bottom-right) and tracks the window scroll. Nothing else renders.

### How do I track a scrollable div instead of the page?

Pass its ref as `container` and place `ScrollProgress` inside a `relative` wrapper around it; the indicators are positioned `absolute` over that wrapper. Without `fixed` or `container`, it renders its own scrolling panel around `children`, with `title` and `subtitle` in a header.

### Why does the bar lag a little behind the scroll?

It follows the scroll through a spring (stiffness 400, damping 40) to give it weight. Under reduced motion it tracks the scroll position exactly.

## Rules for generating code

- Use semantic tokens only (bg, surface, sunken, border, fg, fg-muted, fg-subtle, ink, accent, success, warning, danger). Never raw hex or palette steps like blue-500.
- Shadows only from the set: shadow-xs, shadow-sm, shadow-raised, shadow-md, shadow-lg, shadow-overlay.
- Numbers use tabular-nums. Dark mode is the `dark` class on <html>; components never branch on theme.

## Dependencies

- npm: `motion`

## Related

- [Scroll Progress Rail](https://ui.minidev.pro/docs/scroll-progress-rail/md): A React reading progress bar that fills with page scroll on a spring, with section labels such as intro, product, proof and pricing shown beneath it.
- [Progress](https://ui.minidev.pro/docs/progress/md): A linear progress bar built on Base UI with track, indicator, label and value parts, a default aria label and smooth width transitions. Matches shadcn progress.
- [Scroll Chapter Story](https://ui.minidev.pro/docs/scroll-chapter-story/md): A scroll story of three chapters that slide in as you scroll, with a sticky progress bar that fills with scroll position across the whole section.
- [Animated Feature Row](https://ui.minidev.pro/docs/animated-feature-row/md): A row of feature cards that slide up with a staggered delay when scrolled into view. Pass title and description pairs; reduced motion keeps them still.
- [Card Tilt](https://ui.minidev.pro/docs/card-tilt/md): A card that tilts in 3D toward the pointer on springs, with an accent glare that follows the cursor. It stays flat when reduced motion is preferred.
- [Cursor Spotlight Panel](https://ui.minidev.pro/docs/cursor-spotlight-panel/md): A panel whose accent radial spotlight follows the cursor, driven by Framer Motion values without re-renders. It shows a still surface for reduced motion.

---

All 557 components: https://ui.minidev.pro/llms.txt (full text: https://ui.minidev.pro/llms-full.txt).
