Progress bars communicate how far a task or process has advanced. Export name: Progressbar.
Setup
<script lang="ts">
import { Progressbar } from '.';
</script> Default progress
<Progressbar progress={45} /> Colors
<script lang="ts">
import { Progressbar } from '.';
</script>
<Progressbar progress={45} color="primary" />
<Progressbar progress={45} color="blue" />
<Progressbar progress={45} color="red" />
<Progressbar progress={45} color="green" /> Sizes
size is a height utility class (default h-2.5).
<Progressbar progress={45} size="h-1.5" />
<Progressbar progress={45} size="h-2.5" />
<Progressbar progress={45} size="h-4" />
<Progressbar progress={45} size="h-6" /> Label outside
Upload 50%
<Progressbar progress={50} labelOutside="Upload" /> Label inside
50%
<Progressbar progress={50} labelInside size="h-4" /> Animated
Pass animate to tween width changes when progress updates. Tune with tweenDuration, easing, and precision.
<script lang="ts">
import { Progressbar, Button } from '.';
let progress = $state(20);
</script>
<Progressbar {progress} animate labelOutside="Progress" />
<Button class="mt-3" size="sm" onclick={() => (progress = Math.min(100, progress + 10))}
>Increase</Button
> Props
| Prop | Type | Default | Description |
|---|---|---|---|
progress | number | string | 45 | Completion percent |
color | 'primary' | 'secondary' | 'gray' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'primary' | Bar color |
size | string | 'h-2.5' | Track height class |
labelInside | boolean | false | Show % inside the bar |
labelOutside | string | '' | Label above the bar (also shows %) |
animate | boolean | false | Tween width when progress changes |
tweenDuration | number | 400 | Animation duration (ms) |
easing | EasingFunction | cubicOut | Tween easing |
precision | number | 0 | Decimal places for displayed % |
class / classes | theme slots | — | Slot overrides (base, bar, label, …) |
...rest | HTMLAttributes<HTMLDivElement> | — | Root attributes |