Scroll Progress
Scroll Progress brings controlled expression to your interface.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/scroll-progress.jsonUse it
Scroll horizontally for long lines
"use client";
import {ScrollProgress} from '@/components/jez-ui/ui/scroll-progress';
export default function Example(){
return <><div className="h-96"><ScrollProgress/><h3 className="text-2xl">A sense of where you are.</h3><p className="mt-4 text-sm">The thin line at the top tracks this page as you scroll.</p></div></>;
}Props & types
Scroll horizontally for long lines
{ className?: string }Source
View 2 source files
registry/ui/scroll-progress.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
import { motion, useScroll } from "motion/react";
export function ScrollProgress({ className }: { className?: string }) {
const { scrollYProgress } = useScroll();
return (
<motion.div
aria-hidden="true"
className={cn(
"fixed inset-x-0 top-0 z-50 h-1 origin-left bg-primary",
className,
)}
style={{ scaleX: scrollYProgress }}
/>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
motion@13.2.0 · clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Respect reduced-motion preferences. Decorative effects must not carry essential information. WebGL scenes include a static fallback and only render while visible.
Read the accessibility and performance guide →