Progress

A bar that shows how much of a task is done, from 0 to 100%. It comes in three sizes, can show the percentage before the bar, and fills from the start of the line, so it follows the page's reading direction.

Installation

bash
npx @smicolon/fasla-ui@latest add progress

Run init once per project before adding components. See Installation.

Preview

x

Variants

x
x
x
x
x

Sizes

x
x
x

Percentage label

With showPercentage set to false, the bar shows no number, so give it an aria-label that says what it tracks. Screen readers announce that name with the value. See the example in Storybook.

x
x

Props

PropTypeDefaultDescription
valuenumber0How much is done, from 0 to 100. Values outside the range are clamped.
size"sm" | "md" | "lg""md"Bar height and label size.
showPercentagebooleantrueShows the percentage before the bar.
aria-labelstring—Names the progress bar for screen readers.
getAriaValueText(text, value) => string—Returns the text screen readers hear for the value.
localestring"en-US"Locale used to format the percentage.
classNamestring—Extra classes for the component.

Usage

tsx
import { Progress } from "@/components/ui/progress"

export function UploadProgress({ value }: { value: number }) {
  return (
    <Progress
      value={value}
      size="md"
      aria-label="Uploading quarterly report"
    />
  )
}