Skip to content

Progress

WxProgress is how far along something is — a bar across, or a ring.

A bar, with the figure beside it
38%
38%
38%
Counting something that is not a percentage
3 of 8 files
Rings
38%
38%
No end in sight

Usage

vue
<template>
  <wx-progress :value="percent" show-value aria-label="Import" />
</template>

Count the thing, not the percentage

max means the bar can measure whatever you actually have, and formatter says it in those terms:

vue
<wx-progress
  :value="done"
  :max="files.length"
  show-value
  :formatter="(v, m) => `${v} of ${m} files`"
/>

3 of 8 files tells a reader more than 38%, and it does not round two files into one number.

When there is no number

indeterminate is for work whose end is unknown — a request that has been sent, a job that has been queued. The bar travels instead of filling, and it reports no number at all to a screen reader: a progressbar without aria-valuenow is exactly how ARIA says busy, and I cannot tell you how far. Faking a number there is worse than admitting it.

It is the same element either way, so nothing changes shape when a real figure arrives.

Status is an outcome

success and danger are for a job that finished or failed, not for decoration. A bar that is green all the way up has spent the one colour that means done.

Props

PropTypeDefaultDescription
valuenumber0How far along
maxnumber100What finished looks like
type'line' | 'circle''line'A bar or a ring
status'default' | 'success' | 'warning' | 'danger''default'Colour of the fill
size'sm' | 'md' | 'lg''md'Thickness, and the ring's diameter
thicknessnumberOverrides what size would give it
showValuebooleanfalseShows the figure
formatter(value, max) => stringWhat the figure says
indeterminatebooleanfalseTravels instead of filling
ariaLabelstringName it, when nothing beside it does

Slots: default — replaces the figure, with { value, max, percent }.

Accessibility

The track is a progressbar carrying aria-valuemin, aria-valuemax and — when there is one — aria-valuenow and an aria-valuetext in the reader's own words. Give it an ariaLabel unless there is a visible label beside it. Reduced motion stops the travelling and the spin.

Released under the MIT License.