ScrollProgress
A thin reading indicator driven by real document scroll progress.
Live — this one is real
Scroll this document. The line measures the available document scroll, including the API below.
Usage
import { ScrollProgress, Stack } from "mizu-ui";
export function Example() {
return (
<Stack gap={20}>
<ScrollProgress label="Documentation reading progress" />
<p className="mizu-field-hint">
Scroll this document. The line measures the available document scroll,
including the API below.
</p>
</Stack>
);
}
Source & setup
Add this component to your project with the shadcn CLI. The command copies its source into your configured UI directory, with base.css, Mizu’s tokens, and the stylesheets that hold its rules. Each rule lives in one stylesheet, so components you add together never repeat CSS. In a project without a components.json, run npx shadcn@latest init 0xuser64bit/mizu/preset first: plain init installs shadcn’s theme into your global CSS. Then load the fonts.
npx shadcn@latest add 0xuser64bit/mizu/scroll-progress 0xuser64bit/mizu/stackThe example also uses Stack, so the command adds it too.
Every component imports from its own path, its name in kebab case. Its source, motion/Scroll.tsx, also holds Parallax. Each has its own command and path; adding one after this copies only its small entry file. To paste the example, replace its mizu-ui import with:
import { ScrollProgress } from "@/components/ui/mizu/scroll-progress";
import { Stack } from "@/components/ui/mizu/stack";For npm imports, import mizu-ui/styles.css once. Fonts are optional via mizu-ui/fonts.css. Override --mizu-* tokens or use className for local styling. Requires React and Motion. A Client Component: its source starts with “use client”.
Inspect motion/Scroll.tsx
Source is included in the npm package under src/motion/Scroll.tsx.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | "Reading progress" | Accessible progress name. |
| className | string | — | Optional placement and styling. |
Accessibility
Named progressbar exposes a bounded 0–100 value. No fabricated reading time or completion state.
Motion
A managed Motion scroll value updates the line directly; the announced percentage updates only on integer changes.