Progress Bar Component — Astro

Accessible progress bar with variants, sizes, and indeterminate state

Progress Bar Component

An accessible progress bar for showing completion or loading state. Supports determinate (value-based) and indeterminate (animated) modes, multiple variants and sizes, and an optional percentage label.

Add this component

The command below includes <strong>Progress Bar</strong>—run it in your project directory to install this component (and the CSS if needed). No prompts.

Choose your package manager — click a tab to select, then copy the command.

npm pnpm yarn bun

Props

  • value (number, optional) - Current value, 0 to max (default: 0)
  • max (number, optional) - Maximum value (default: 100)
  • variant (string, optional) - primary, success, warning, error, info (default: primary)
  • size (string, optional) - sm, md, lg (default: md)
  • showLabel (boolean, optional) - Show percentage label (default: false)
  • indeterminate (boolean, optional) - Animated loading state, ignores value (default: false)
  • label (string, optional) - Accessible label (aria-label)
  • class (string, optional) - Additional CSS classes

Basic Usage

Live Example

Usage

Full example for each framework (Astro, Vanilla, Svelte, Vue, React). Switch framework via View as or by clicking a Usage tab—both stay in sync.

Astro Vanilla Svelte Vue React

With Label

Use showLabel to display the percentage next to the bar.

Live Example
astro astro
<ProgressBar value={75} max={100} showLabel />

Variants

Live Example

Sizes

Live Example

Indeterminate

Use indeterminate for loading states when progress is unknown. The bar shows an animated fill. Provide an aria-label (e.g. "Loading") for accessibility.

Live Example
astro astro
<ProgressBar indeterminate label="Loading" />

Custom Max

Use max and value for non-percentage progress (e.g. steps). The bar width is computed as value/max.

Live Example (3 of 5 steps)
astro astro
<ProgressBar value={3} max={5} showLabel />

Features

  • Semantic - role="progressbar" with aria-valuenow, aria-valuemin, aria-valuemax
  • Indeterminate - aria-valuetext="Loading" when progress is unknown
  • Variants - Primary, success, warning, error, info using theme variables
  • Sizes - sm, md, lg bar heights
  • Reduced motion - Indeterminate animation disabled when user prefers reduced motion

Other frameworks: Vanilla · Svelte · Vue · React