Skip to content
Onycx-ui
ESC

Scroll Progress

Show how far a reader has scrolled with a thin progress bar at the top of the page.

Dependencies
motion
Size
109 lines
Controls
8 controls

Installation

CLI · shadcn registry

npx shadcn@latest add https://ui.onycx.dev/r/scroll-progress.json

1 · Dependencies

npm install motion

2 · Copy the source

components/onycx/scroll-progress.tsx

Requires React 19 and Tailwind CSS v4. Copy the source from the scroll-progress.tsx tab after tweaking: your values are baked in as the new defaults. Exported image examples use portable sample artwork. Replace it with your own media as needed.

Props

PropTypeDefaultDescription
position"top" | "bottom""top"Viewport edge the bar is pinned to.
heightnumber2Bar thickness in px.
from / via / tostring"#5a0f14" / "#8b1e2d" / "#c8ae80"Three-stop horizontal gradient (0 / 50 / 100%).
offsetLeftnumber0Left inset from 1024px up, for a fixed side nav (the original used 92px).
trackbooleanfalseFaint full-width track behind the fill.
showBadgebooleanfalseOptional tabular percentage pill that fades in after 2%.
labelstring""Accessible name. When set the bar becomes role=progressbar with aria-valuenow; empty keeps it aria-hidden.
zIndexnumber70Stacking order above fixed headers.