Skip to content

Progress Bar

A horizontal bar indicating the completion of a task. Supports determinate (with percentage) and indeterminate (animated) modes.

Preview

Uploading files72%
Storage used45%

Variants

Brand — 60%
Success — 80%
Warning — 50%
Error — 90%

Sizes

Thin (4 px)
Default (8 px)
Thick (12 px)

Indeterminate

Props

PropTypeDefaultDescription
valuenumber--Progress percentage (0–100)
variant'brand' | 'success' | 'warning' | 'error''brand'Fill colour
size'thin' | 'default' | 'thick''default'Track height
indeterminatebooleanfalseAnimated indeterminate mode
labelstring--Visible label text
showValuebooleanfalseShows percentage text

Code example

React

tsx
import { ProgressBar } from '@thepace/lexicon/components';

<ProgressBar value={72} label="Uploading files" showValue />
<ProgressBar variant="success" value={100} />
<ProgressBar indeterminate />

Vanilla HTML

html
<div class="lex-progress">
  <div class="lex-progress__row">
    <span class="lex-progress__title">Uploading</span>
    <span class="lex-progress__value">72%</span>
  </div>
  <div class="lex-progress__track lex-progress__track--default"
       role="progressbar" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100">
    <div class="lex-progress__fill lex-progress__fill--brand" style="width: 72%;"></div>
  </div>
</div>

CSS class reference

ClassPurpose
.lex-progressContainer
.lex-progress__trackBackground track
.lex-progress__track--thin4 px height
.lex-progress__track--default8 px height
.lex-progress__track--thick12 px height
.lex-progress__fillFilled portion
.lex-progress__fill--brandBrand colour fill
.lex-progress__fill--successGreen fill
.lex-progress__fill--warningAmber fill
.lex-progress__fill--errorRed fill
.lex-progress__fill--indeterminateAnimated fill

Accessibility

  • Use role="progressbar" on the track element.
  • Set aria-valuenow, aria-valuemin="0", aria-valuemax="100".
  • For indeterminate mode, omit aria-valuenow.
  • Provide an aria-label describing the operation.

Guidelines

Do

  • Show the percentage value for determinate progress.
  • Use the appropriate colour variant (error when storage is critical, etc.).

Don't

  • Don't use a progress bar for instantaneous operations.
  • Don't show a progress bar stuck at 0% or 99% for extended periods.

Released under the MIT License. A product by the pace.