Skip to content
TopClass UI

Progress

How far along a task is: a neutral track with a bar in the tone, read by a screen reader as a progressbar from 0 to 100.

server - 0 KB

Progress

server - 0 KB

How far along a task is: a neutral track with a bar in the tone, read by a screen reader as a progressbar from 0 to 100.

Install

Try it

value
tone
size
indeterminate

The code

progress.tsx
import { Progress } from 'topclassui/progress'

<div className="grid max-w-sm">
  <Progress aria-label="Upload" />
</div>

It renders no text and clamps value to 0-100, so name it with aria-label or aria-labelledby.

Every state

5 states
Empty
Part way
Complete
Indeterminate
Tones

Import from the package

topclassui/progress
import { Progress } from 'topclassui/progress'

Install once:npm i topclassui@beta zod

Examples

  • For an upload, a quota or a step in a long job. value is a percentage, clamped to 0-100 before it reaches ARIA or the bar; for a custom range, use Meter.
  • indeterminate is for a wait of unknown length: no value is announced and a short bar pulses.
  • size sets the track height from the spacing scale, so it follows density; custom emits none and your class sets it.
  • The track fills its container. Give it a fixed width with className, as a bar in a file row does.
labelled
Storage: 7.2 GB of 10 GB
values
Not started
Uploading
Halfway
Almost there
Done
tones
sizes
indeterminate
file-row
brief.pdf
custom-size
In Arabic, right to left
رفع الملف

Props

The props of Progress
PropTypeDefaultLimitsDescription
aria-labelstring--The name read out when no visible text names the bar.
aria-labelledbystring--The id of the visible text that names the bar.
indeterminatebooleanfalse-For a wait of unknown length: no value is announced and a short bar pulses.
sizexs | sm | md | lg | xl | custom"md"-The shared size scale, which sets the track height; custom emits none.
toneprimary | neutral | success | warning | danger | info"primary"-The colour of the bar; the track stays neutral in every tone.
valuenumber, min 0, max 1000min 0, max 100How far along, as a percentage; anything outside 0-100 is clamped.

Keyboard and accessibility

Nothing to operate: it is not interactive on its own.

  • A name is required: the type refuses a Progress with neither aria-label nor aria-labelledby.
  • It writes role="progressbar" with a minimum of 0, a maximum of 100 and the clamped value; an indeterminate bar carries no value at all.
  • The bar takes the tone's text colour and a line-strong outline marks the end of the range. Under forced colours the track is Canvas and the bar CanvasText, and reduced motion stops the pulse.

Right to left

The bar grows from the inline start: from the right in Arabic, with no class of its own for it.

Server and client

Renders on the server and ships no JavaScript.

Files: index.tsx.

On the chip: server - 0 KB.