Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
Installation
Install the packages
Add the shadcn-vue component
Animate it
The CLI finds your shadcn-vue components through components.json, swaps their primitive imports for Animate UI's and removes the CSS animation classes Motion replaces.
Usage
<script setup lang="ts">
import { ref } from 'vue';
import {
ProgressIndicator,
ProgressRoot,
} from '@animate-ui/vue/primitives/reka-ui';
const value = ref(40);
</script>
<template>
<ProgressRoot
:model-value="value"
class="h-2 w-full overflow-hidden rounded-full"
>
<ProgressIndicator
class="h-full w-full bg-primary"
:style="`transform: translateX(-${100 - value}%);`"
/>
</ProgressRoot>
</template>Animation
The motion of Animate UI's React 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). reka-ui leaves the indicator's position to you: shadcn-vue moves it with
transform: translateX(-…%)in its style, as a string or an object. 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.
- Under reduced motion, the indicator jumps to each value.
- shadcn-vue's
transition-allon the indicator would run on top of Motion: the CLI removes it.
API Reference
Every part takes exactly the props of reka-ui's Progress. Animate UI adds the animation props below.
ProgressRoot
reka-ui props only. It isn't animated.
ProgressIndicator
reka-ui props, plus:
| Prop | Type | Default |
|---|---|---|
transition? | Transition | { type: 'spring', stiffness: 300, damping: 35, restDelta: 0.01, restSpeed: 0.1 } |
AnimateUIProvider's tempo scales the spring with everything else.