Progress Bar
Animated progress bar with striped variant.
<div class="w-full max-w-md space-y-4">
<div>
<div class="flex justify-between text-xs font-bold text-slate-600 dark:text-slate-300 mb-1.5">
<span>Uploading</span><span>68%</span>
</div>
<div class="h-2.5 rounded-full bg-slate-300 overflow-hidden">
<div class="h-full w-[68%] rounded-full bg-gradient-to-r from-indigo-500 to-purple-500 transition-all duration-500"></div>
</div>
</div>
<div>
<div class="flex justify-between text-xs font-bold text-slate-600 dark:text-slate-300 mb-1.5">
<span>Processing</span><span>Live</span>
</div>
<div class="h-2.5 rounded-full bg-slate-300 overflow-hidden">
<div class="h-full w-full rounded-full bg-indigo-500 progress-stripes"></div>
</div>
</div>
</div>
<style>
@keyframes progress-slide {
0% { background-position: 0 0; }
100% { background-position: 28px 0; }
}
.progress-stripes {
background-image: linear-gradient(45deg, rgba(255,255,255,0.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.25) 75%, transparent 75%);
background-size: 28px 28px;
animation: progress-slide 0.8s linear infinite;
}
</style>Free to use in personal and commercial projects. No attribution required.
Variants
Same component, different looks. Preview each one live and copy the code you like.
Thin emerald
The thin bar suits inline contexts like table rows and file lists.
Segmented
Segmented bars show discrete stages, like multi-file uploads.
Striped rose
Striped rose draws the eye to urgent processes like deployments.
About this progress bar
Progress bars turn waiting into information. A determinate bar (68%) tells users exactly where things stand; an indeterminate striped bar says "working on it" when you cannot measure progress. This tailwind progress bar gives you both, plus the classic animated stripes.
The striped variant uses a repeating-linear-gradient at 45 degrees, animated by shifting background-position. It is the same technique Bootstrap popularized, rebuilt in a few lines of CSS. The gradient fill on the determinate bar (indigo to purple) looks more premium than a flat color.
Always pair a progress bar with a label: what is progressing and the percentage. A naked bar without context creates more anxiety than it solves. For uploads, show the filename too.
Waiting without information feels longer than waiting with it; that quirk of perception is what progress bars exploit. A determinate bar answers how much is done, an indeterminate one answers whether the thing is still alive. Both beat a frozen screen, and both turn an anxious wait into a tolerable one.
The track is h-2.5 rounded-full bg-slate-300 overflow-hidden; the fill is h-full rounded-full at w-[68%] with bg-gradient-to-r from-indigo-500 to-purple-500 and transition-all duration-500 so width changes glide instead of jumping. For the indeterminate state, diagonal stripes come from a repeating gradient at 45 degrees, set marching by the progress-slide keyframes nudging background-position from 0 to 28px. Labels sit above in a flex justify-between row naming the task and the percentage.
Size the bar to its importance: h-1.5 for subtle inline progress, h-3 for hero moments like file uploads. Update the width by setting the style value and letting the CSS transition interpolate; never step it with timers. For uploads, show the filename and speed next to the percentage, because context is what actually calms the user.
The rendering mistake is forgetting overflow-hidden on the track, so at 100% the fill's rounded end pokes outside the track's rounded end and the bar looks broken at the exact moment it should look finished. One class on the track fixes it, but it's the kind of detail you only catch by testing the full state.
Where to use it
- ✓ File uploads
- ✓ Form completion
- ✓ Onboarding progress
- ✓ Loading states
Customization tips
Animate width changes with transition-all duration-500 for smooth fills. Use h-1.5 for subtle bars and h-3 for prominent ones. For indeterminate progress without stripes, use the sliding bar loader pattern instead.
Design notes
When to use
A progress bar earns its place during operations that take several seconds but do finish, like file uploads or multi-step imports. The percentage label next to the bar answers the two questions users always have: how much is done and is it still moving. The striped variant adds a sense of motion that reassures during stalls where the number itself barely changes.
What to avoid
Do not show a progress bar for instant actions, it will flash and vanish before anyone reads it, which looks like a glitch. Never let a bar sit at 99 percent for a long time while the real work happens silently afterward, that mismatch destroys trust. And do not use a determinate bar when you genuinely do not know the duration, use an indeterminate spinner instead.
Accessibility
Give the bar role progressbar with aria-valuenow so screen readers announce progress, and do not update the announcement every single percent or it will chatter nonstop. For the animated stripes, respect prefers-reduced-motion and render a static bar instead.
Frequently asked questions
How do I animate a progress bar fill?
Set the inner bar width as a percentage and add transition-all duration-500. When JavaScript updates the width, it animates smoothly.
Determinate vs indeterminate progress, when to use which?
Determinate (with %) when you can measure progress: uploads, multi-step forms. Indeterminate (animated stripes) when you cannot: server processing, searches.
How do I make striped progress bars?
Use a 45-degree repeating gradient as background-image and animate background-position with keyframes. The stripes appear to slide.
How do I update a progress bar smoothly with JavaScript?
Put a CSS transition on the fill's width, then update style.width to the new percentage. The transition animates between values automatically. Always update aria-valuenow in the same step so assistive tech stays in sync with the visual fill.
What ARIA attributes does a progress bar need?
Use role="progressbar" with aria-valuemin, aria-valuemax, and aria-valuenow, plus an accessible name via aria-label or aria-labelledby. For indeterminate progress where the percent is unknown, omit aria-valuenow. Never communicate progress through color alone.
How do I show percentage text inside a progress bar?
Place a centered span inside the fill container with position absolute and full width text alignment. Use a contrasting text color that stays readable over both the fill and the track, or put the label beside the bar. Update the text content whenever the value changes.
Related elements
Saved successfully
Your changes are live.
Toast Notification
Slide-in toast notification with icon and close button.
Star Rating
Interactive star rating with hover fill.
Success. Your profile has been updated.
Warning. Your trial ends in 3 days.
Error. Payment failed. Try again.
Info. New features are available.
Alert Banner
Dismissible alert banner in 4 variants.