Morphos
Feedback

Progress

A progress bar with determinate and indeterminate modes.

Interactive example

Installation

npm install @morphos/feedback
pnpm add @morphos/feedback
yarn add @morphos/feedback
bun add @morphos/feedback

Import

import { Progress } from '@morphos/feedback'

Usage

// Determinate
<Progress value={60} aria-label="Upload progress" />

// Indeterminate (value omitted)
<Progress aria-label="Loading…" />

Props

PropTypeDefaultDescription
valuenumber | undefinedundefinedCurrent value. Omit for indeterminate mode
minnumber0Minimum value
maxnumber100Maximum value
classstringCSS class on the root element
idstringid on the root element
aria-labelstringAccessible label
aria-labelledbystringid of an external label element

data-* attributes

AttributeElementWhen present
data-indeterminateRootvalue is undefined
data-valueRootvalue is set — contains the numeric value as a string

CSS custom property

PropertyValue
--progressPercentage (0%100%), set as an inline style on the root only when determinate

Styling example

.morphos-progress {
  position: relative;
  display: block;
  width: 100%;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--morphos-radius-full);
  background: var(--morphos-color-bg-subtle);
}

.morphos-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--progress, 0%);
  background: var(--morphos-color-accent);
  border-radius: var(--morphos-radius-full);
  transition: width var(--morphos-transition-medium);
}

.morphos-progress[data-indeterminate]::after {
  width: 40%;
  animation: morphos-progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes morphos-progress-indeterminate {
  0% { left: -40%; }
  100% { left: 100%; }
}

Apply class="morphos-progress" to Progress to use this recipe.

Accessibility

Progress renders as role="progressbar" with aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext (shows the percentage string). In indeterminate mode, aria-valuenow and aria-valuetext are omitted.

Always provide either aria-label or aria-labelledby. Without a label, screen readers have no way to describe what is progressing.

On this page