ScrollProgress
Ring that pops in as you scroll, counts the percent read, turns green at the end and becomes a back-to-top arrow on hover. Also a thin bar variant. Effects.
Open playgroundAbout
ScrollProgress is a React component in the Effects category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ScrollProgress } from "@ashutoshswamy/smoui" and set container, variant, label.
Install
npm i @ashutoshswamy/smouiUsage
import { ScrollProgress } from "@ashutoshswamy/smoui";
<div className="fixed bottom-6 right-6">
<ScrollProgress />
</div>Props 3
- container
Scroll container. Omit to follow the page.
RefObject<HTMLElement>- variant
Back-to-top ring or full-width reading bar.
"ring""bar"default"ring"- label
Accessible name.
stringdefault"Back to top"
More effects components
- AuroraSlow drifting colour behind your content. Only transforms animate; it stands still with reduced motion.
- BorderBeamA light that runs around the edge of whatever it wraps, at an even pace along straight sides and rounded corners alike. Reduced motion parks it still.
- CompareSliderBefore/after reveal. Drag the divider; the top layer follows on a spring. It sweeps once to show it moves.
- ConfettiButton that throws flat confetti on press. Pieces fly out, tumble, then fall and fade.
- DotFieldA grid of dots that swells and shrinks away from the pointer, then springs home. One canvas, asleep when nothing moves.
- GlassLensA magnifier that drifts after the cursor like a drop of water. Press to zoom further.