Raft Design System

Components · Feedback

Progress

A bar that shows how far a measurable task has gone, such as an upload or a conversion, with a label and its value.

StableAlso called ProgressBar, Loading
import { Progress } from "@botiverse/raft-ui";

A progress bar shows how far something with a known percentage has gone: an upload, a file being processed, a channel being converted. Next to it, a label says what it is and how far it has got. Which loading indicator fits which wait is in Choosing a component.

progress/compositions/preview

When to use

SituationUse
The percentage is knownProgress
The duration is unknownSpinner, not a progress bar
The layout of what is loading is knownSkeleton
How much of a usage limit is usedMeter
A page loads under its top barPageLoadingLine

Meter vs Progress: a progress bar is a task that only moves forward and is done at 100%, so the fill turns success when it gets there; a meter is a quantity within a range that rises and falls, such as an allowance that is used up and comes back. Don't draw usage as progress: a used-up allowance would turn success and read as finished.

Anatomy

  • Progress: the root; takes the value. Required.
  • ProgressHeader: an optional row above the track, holding ProgressLabel (what it is) and ProgressValue (how far, in Space Mono).
  • ProgressTrack: the fill-medium track, translucent so it shows on any surface (Color). Required.
  • ProgressIndicator: the fill, a sticker with an ink edge. Required.

Variants

VariantUse for
The default (variant="primary")Progress of any kind: an info fill
variant="warning"Only usage near a limit drawn before Meter; new usage is a Meter
CompleteWhen value reaches the maximum the fill turns success on its own
  • Don't use variant="danger": nothing a progress bar shows is irreversible (Color).
  • information and accent are the same as the default. Use the default.
progress/compositions/embedded-progress

States

  • Don't show a bar whose percentage can't be computed. Use a Spinner instead of a fake or indeterminate bar.

Content

  • Name what is in progress in ProgressLabel: "Uploading design-crop.png", "Converting #launch-week".
  • Show how far it has got in ProgressValue, as a percentage or as an amount out of the total.

Accessibility

Progress wraps Base UI's Progress, which gives it role="progressbar" and its value.

  • ProgressLabel gives the bar its accessible name. Without a visible label, pass aria-label to Progress.
  • Keep ProgressLabel even when you leave out ProgressValue.

Rules

  • Put a bar inside a file card, thumbnail or other rounded container on its own thin track, never along its edge (Shape).

API

Progress

PropTypeDefault
size"sm" | "md" | "lg""md"
variant"primary" | "accent" | "warning" | "danger" | "information" | "success""primary"
aria-valuetextA string value that provides a user-friendly name for `aria-valuenow`, the current value of the progress bar.string
formatOptions to format the value.Intl.NumberFormatOptions
getAriaValueTextAccepts a function which returns a string value that provides a human-readable text alternative for the current value of the progress bar.(formattedValue: string, value: number | null) => string
localeThe locale used by `Intl.NumberFormat` when formatting the value. Defaults to the user's runtime locale.string | Intl.Locale | readonly (string | Intl.Locale)[]
maxThe maximum value.number100
minThe minimum value.number0
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)
value (required)The current value. The component is indeterminate when value is `null`.number

Also takes the attributes of its element.

ProgressHeader

Takes the attributes of its element.

ProgressIndicator, ProgressLabel, ProgressTrack

PropTypeDefault
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

ProgressValue

PropTypeDefault
children(formattedValue: string | null, value: number | null) => React.ReactNode
renderAllows you to replace the component's HTML element with a different tag, or compose it with another component.ReactElement | ((props, state) => ReactElement)

Also takes the attributes of its element.

Changes

  • 0.107.0 · FixedMeter and Progress tracks show on any surface ([Color › Hover overlays](https://raft-design.botiverse.build/foundations/color/#hover-overlays)): MeterTrack and ProgressTrack draw their empty track in translucent fill-medium instead of opaque fill-muted, so it lays a step darker than whatever the bar sits on.