Back to Base UIYou are on Progress.

Progress

A progress bar whose width settles on a soft spring without overshoot.

Available inAvailable in React, Vue, Svelte, Solid, JavaScript· All five frameworks

Libraries

Base UI

Motion

Spring + short tween

Reduced motion

Fade in place
progress.tsx
Play with the real component, then read the code it ships with.All components
01

Installation

Installing for React·components/prequelui/progress.tsx

Add the component

npx shadcn@latest add https://prequeluianimate.terravidhal.me/r/react/progress.json
npmthe default on every machine

First component? Set up your project first

Frameworks

The live preview is React. Each tab below is the file that ships for that framework, with the same durations, springs and reduced-motion rule.

5 runtimes
progress.tsx
"use client";

import * as React from "react";
import { animate, motion, useReducedMotion } from "motion/react";
import { cn } from "@/lib/utils";

export type ProgressProps = {
  value?: number;
  max?: number;
  label?: string;
  showValue?: boolean;
  className?: string;
};

const settle = {
  type: "spring",
  stiffness: 300,
  damping: 35,
  restDelta: 0.01,
  restSpeed: 0.1,
} as const;

const count = { type: "spring", stiffness: 90, damping: 50 } as const;

export function Progress({
  value = 0,
  max = 100,
  label = "Uploading assets",
  showValue = true,
  className,
}: ProgressProps) {
  const reduce = useReducedMotion();
  const safeMax = max > 0 ? max : 100;
  const clamped = Math.min(safeMax, Math.max(0, value));
  const percent = (clamped / safeMax) * 100;
  const [shown, setShown] = React.useState(reduce ? clamped : 0);

  React.useEffect(() => {
    if (reduce) {
      setShown(clamped);
      return;
    }
    const controls = animate(shown, clamped, {
      ...count,
      onUpdate: (latest) => setShown(latest),
    });
    return () => controls.stop();
  }, [clamped, reduce]);

  return (
    <div className={cn("w-full max-w-[380px]", className)}>
      <div className="mb-2 flex items-center justify-between text-[13px] text-muted-foreground">
        <span>{label}</span>
        {showValue && <span className="tabular-nums">{Math.round(shown)}%</span>}
      </div>
      <div
        role="progressbar"
        aria-valuemin={0}
        aria-valuemax={safeMax}
        aria-valuenow={clamped}
        className="h-2 w-full overflow-hidden rounded-full bg-accent"
      >
        <motion.div
          initial={false}
          animate={{ width: `${percent}%` }}
          transition={reduce ? { duration: 0 } : settle}
          className="h-full rounded-full bg-foreground"
        />
      </div>
    </div>
  );
}

Install

npx shadcn@latest add https://prequeluianimate.terravidhal.me/r/react/progress.json
npmthe default on every machine

Dependencies

motion lucide-react

The registry keeps the component source, its motion tokens and the reduced-motion branch together, so the install never pulls a different animation from the preview.

02

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

progress.tsx
import { Progress } from "@/components/prequelui/progress";

export default function Demo() {
  return <Progress value={64} className="w-[360px]" />;
}
import { Progress } from "@/components/prequelui/progress";

export function Variant() {
  return (
    <Progress tempo={1.2}>
      …
    </Progress>
  );
}
03

Animation

The bar never jumps between values. Each new value retargets the same width spring, which is damped just enough to settle without a visible overshoot, even when the value moves backwards.

  • Width spring: 300 / 35, restDelta 0.01, restSpeed 0.1.
  • Retargeting keeps the current velocity instead of restarting.
  • The track colour is static; only the indicator changes width.
  • Reduced motion writes the new width immediately.
spring 300 / 35restDelta 0.01no overshootretargetable
04

API Reference

Every part takes exactly the props of the Progress primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.

Progress

PropTypeDefault
valuenumber0
maxnumber100
indicatorClassNamestring—
transitionTransitioncomponent spring or tween
classNamestring—

Next component

Questionnaire

A multi-step questionnaire that recomposes its height between questions.