Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
Installation
Install the packages
Add the shadcn/ui component
Animate it
The CLI finds your shadcn/ui components through components.json, swaps their primitive imports for Animate UI's and removes the CSS animation classes Motion replaces.
Usage
Import the primitive from Animate UI instead of Radix UI. Everything else stays the same.
import { Progress } from '@animate-ui/react/primitives/radix-ui';
export function Upload({ value }: { value: number }) {
return (
<Progress.Root value={value} className="h-2 overflow-hidden rounded-full">
<Progress.Indicator
className="size-full bg-primary"
style={{ transform: `translateX(-${100 - value}%)` }}
/>
</Progress.Root>
);
}Coming from the @radix-ui/react-progress package? Use the subpath: import * as ProgressPrimitive from '@animate-ui/react/primitives/radix-ui/progress'.
Animation
The motion of Animate UI v1's progress:
- Indicator springs to each new value (stiffness 300, damping 35: most of the way in ~230ms and settled by ~550ms, with no jump at the end; no overshoot, which would uncover the start of the track). Radix leaves the indicator's position to you: shadcn/ui moves it with
style={{ transform: translateX(-…%) }}, thexv1 animated. Animate UI animates that translation instead of jumping to it, as anxthat keeps its momentum when a new value arrives mid-way. - It starts at its value on mount, with no animation.
- shadcn/ui's
transition-allon the indicator would run on top of Motion: the CLI removes it. - Under reduced motion, the indicator jumps to each value.
API Reference
Every part takes exactly the props of Radix UI's Progress. Animate UI adds the animation props below.
Root
Radix UI props only.
Indicator
Radix UI props, plus:
| Prop | Type | Default |
|---|---|---|
transition? | Transition | { type: 'spring', stiffness: 300, damping: 35, restDelta: 0.01, restSpeed: 0.1 } |
AnimateUIProvider's tempo scales these transitions with everything else.