UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

Motion Primitives/Scroll Progress

Navigation
1 of 2
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

2 versions·2 librariesCompare all progress bars →

  • Motion Primitives
  • Magic UI

Scroll Progress

A component that visualizes scroll progress with animated indicators.

npx shadcn@latest add https://motion-primitives.com/c/scroll-progress.json
Open in v0 Docs Repo
Library
Motion Primitives
License
MIT
Stack
React · Tailwind CSS · animated
Packages
motion
Size
43 lines
Demo
Written by UIPin: the library doesn’t ship a usage example, so the preview uses one of ours (in the code below).

Code

scroll-progress.tsx

'use client';

import { motion, SpringOptions, useScroll, useSpring } from 'motion/react';
import { cn } from '@/lib/utils';
import { RefObject } from 'react';

export type ScrollProgressProps = {
  className?: string;
  springOptions?: SpringOptions;
  containerRef?: RefObject<HTMLDivElement>;
};

const DEFAULT_SPRING_OPTIONS: SpringOptions = {
  stiffness: 200,
  damping: 50,
  restDelta: 0.001,
};

export function ScrollProgress({
  className,
  springOptions,
  containerRef,
}: ScrollProgressProps) {
  const { scrollYProgress } = useScroll({
    container: containerRef,
    layoutEffect: Boolean(containerRef?.current),
  });

  const scaleX = useSpring(scrollYProgress, {
    ...DEFAULT_SPRING_OPTIONS,
    ...(springOptions ?? {}),
  });

  return (
    <motion.div
      className={cn('inset-x-0 top-0 h-1 origin-left', className)}
      style={{
        scaleX,
      }}
    />
  );
}

More like this

Cutout Card

Cult UI·Cards

Features 1

SmoothUI·Cards

Vote Tally

Cult UI·Data display

Loading Carousel

Cult UI·Feedback & loaders

Ai Citations

Kokonut UI·Other

Input Group

shadcn/ui·Inputs & forms

Minimal Card

Cult UI·Cards

Testimonials 3

SmoothUI·Cards

Edge Blur

Cult UI·Cursor & effects

Animated List

Eldora UI·Data display

Scroll Area

shadcn/ui·Data display

Faq 1

SmoothUI·Data display

Side Panel

Cult UI·Other

Animated List

Magic UI·Data display

Input

HextaUI·Inputs & forms