Skip to content
All components
Feedback

Progress

Show how much of a task is complete when the amount of work is known, such as an upload, a setup flow or a usage quota.

A determinate progress bar.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add progress

Then import it from @/components/ui/progress. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Adjustable

Update a named progress bar and its visible percentage together. The buttons change the value that both the fill and aria-valuenow report.

"use client"

import * as React from "react"

import { Button } from "@/components/ui/button"
import { Progress } from "@/components/ui/progress"

export function ProgressAdjustable() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="flex w-full flex-col gap-4">
        <Progress value={value} aria-label="Upload progress" />
        <div className="flex items-center justify-between">
          <span className="text-paragraph-sm text-sub-600">{value}%</span>
          <div className="flex gap-2">
            <Button
              size="xs"
              intent="neutral"
              emphasis="stroke"
              onClick={() => setValue((current) => Math.max(0, current - 15))}
            >
              -15
            </Button>
            <Button
              size="xs"
              intent="neutral"
              emphasis="stroke"
              onClick={() => setValue((current) => Math.min(100, current + 15))}
            >
              +15
            </Button>
          </div>
        </div>
      </div>
    </div>
  )
}

With value text

Label progress with visible text and a matching value label. getValueLabel makes the announced value match the visible units.

"use client"

import * as React from "react"

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

export function ProgressWithValueText() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="flex w-full flex-col gap-2">
        <div className="flex items-baseline justify-between gap-4 text-paragraph-sm">
          <span id="progress-demo-storage" className="text-label-sm text-strong-950">
            Storage used
          </span>
          <span className="text-sub-600">7.5 of 10 GB</span>
        </div>
        <Progress
          value={7.5}
          max={10}
          aria-labelledby="progress-demo-storage"
          getValueLabel={(current, maximum) => `${current} of ${maximum} GB`}
        />
      </div>
    </div>
  )
}

Steps

Report step progress with a custom maximum. The fill is computed from value and max, so two of five steps fills forty percent.

"use client"

import * as React from "react"

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

export function ProgressSteps() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="flex w-full flex-col gap-2">
        <div className="flex items-baseline justify-between gap-4 text-paragraph-sm">
          <span id="progress-demo-setup" className="text-label-sm text-strong-950">
            Workspace setup
          </span>
          <span className="text-sub-600">Step 2 of 5</span>
        </div>
        <Progress
          value={2}
          max={5}
          aria-labelledby="progress-demo-setup"
          getValueLabel={(current, maximum) => `Step ${current} of ${maximum}`}
        />
      </div>
    </div>
  )
}

Upload list

Show one labelled progress bar per file in a list. Each bar takes its name from the file name by ID.

"use client"

import * as React from "react"

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

const uploads = [
  { id: "progress-demo-upload-1", name: "site-photos.zip", value: 100, detail: "Uploaded" },
  { id: "progress-demo-upload-2", name: "floor-plan.pdf", value: 62, detail: "62% of 18 MB" },
  { id: "progress-demo-upload-3", name: "contract-draft.docx", value: 8, detail: "8% of 2 MB" },
]

export function ProgressUploadList() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <ul aria-label="Uploads" className="flex w-full flex-col gap-4">
        {uploads.map((upload) => (
          <li key={upload.id} className="flex flex-col gap-2">
            <div className="flex items-baseline justify-between gap-4 text-paragraph-sm">
              <span id={upload.id} className="min-w-0 truncate text-label-sm text-strong-950">
                {upload.name}
              </span>
              <span className="shrink-0 text-sub-600">{upload.detail}</span>
            </div>
            <Progress value={upload.value} aria-labelledby={upload.id} />
          </li>
        ))}
      </ul>
    </div>
  )
}

Value right

Place the value text to the right of the bar. The visible percentage is hidden from assistive technology because the progress bar already exposes its value.

"use client"

import * as React from "react"

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

export function ProgressValueRight() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="flex w-full items-center gap-3">
        <Progress value={40} aria-label="Profile completion" className="flex-1" />
        <span aria-hidden="true" className="w-10 shrink-0 text-end text-label-sm text-strong-950 tabular-nums">
          40%
        </span>
      </div>
    </div>
  )
}

Value below

Place the value text below the bar. The visible value aligns to the end of the bar and is not announced twice.

"use client"

import * as React from "react"

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

export function ProgressValueBelow() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="flex w-full flex-col gap-2">
        <Progress value={72} aria-label="Course progress" />
        <span aria-hidden="true" className="self-end text-label-sm text-strong-950 tabular-nums">
          72%
        </span>
      </div>
    </div>
  )
}

Floating value

Float the value above the current position. The floating label follows the value along the inline axis and is decorative.

"use client"

import * as React from "react"

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

export function ProgressFloatingValue() {
  const [value, setValue] = React.useState(45)

  return (
    <div className="flex w-full max-w-sm flex-col gap-8">
      <div className="relative w-full pt-9">
        <span
          aria-hidden="true"
          className="absolute top-0 -translate-x-1/2 rounded-8 border border-soft-200 bg-white-0 px-2 py-1 text-label-xs text-strong-950 shadow-regular-sm tabular-nums rtl:translate-x-1/2"
          style={{ insetInlineStart: "64%" }}
        >
          64%
        </span>
        <Progress value={64} aria-label="Import progress" />
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

Progress

Show measurable task completion with an accessible explanation.

Progress props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
Inherited props (17)
Progress inherited props
PropTypeDefaultDescription
valuenumber | null | undefined—Current progress measurement. A null value represents an indeterminate operation; provide an accessible progress name.
maxnumber | undefined—Maximum measurement against which the current progress value is evaluated.
getValueLabel((value: number, max: number) => string) | undefined—Create the progress value's accessible text from its current value and maximum.
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLDivElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLDivElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLDivElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLDivElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLDivElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.
asChildboolean | undefined—Merge this part into one child instead of its default element. Preserve that child's semantics, ref support and accessibility attributes.
refReact.Ref<HTMLDivElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).

Accessibility & usage

From registry/ui/progress.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Uploads, downloads, exports and imports that report a percentage or byte count.
  • Multi-step flows where the current step and total are known ('Step 2 of 5').
  • Usage against a limit, such as storage used or seats taken, with the value shown in text.

When not to use

  • Waits of unknown length; Progress with value={null} shows an empty track with no animation, which reads as 'not started'. Use a spinner.
  • Ratings, scores or skill levels that are not progress toward completion.
  • Very short operations (under about a second), where the bar only flashes.

Anatomy

Progress
Radix Progress root with role="progressbar", value, max (default 100) and optional getValueLabel. The track is a thin rounded bar.
Indicator
The fill, rendered internally. Its width is computed from value and max with the same normalization Radix uses for aria-valuenow.
Value text (composition)
Optional visible value placed to the right, below, or floating above the current position. Hide it from assistive technology when the progress bar already exposes the same value.

Keyboard & interaction

  • Not focusable and not operable; it reports state only.
  • aria-valuenow, aria-valuemax and aria-valuetext come from value, max and getValueLabel; data-state is loading, complete or indeterminate.
  • Out-of-range or missing values are treated as unknown: the fill shows zero and no percentage is announced.
  • The fill animates between values and the transition turns off under prefers-reduced-motion.
  • The bar does not announce changes on its own; announce milestones or completion with a status message if people need to hear them.

Responsive behavior

  • The track fills its container width, so it reflows at any viewport; keep the label and value text above or beside it and let them wrap.
  • On narrow screens put the value text on its own line rather than truncating it.
  • Track height is 6px by default; it is not a touch target, but make it tall enough to see clearly at a distance when it is the main feedback.

Content guidelines

  • Label what is progressing: 'Uploading floor-plan.pdf', 'Storage used'.
  • Show the value in the most useful unit: percent for tasks, amounts for quotas ('7.5 of 10 GB'), steps for flows ('Step 2 of 5').
  • When complete, replace or follow the bar with a clear outcome ('Uploaded') and the next step.
  • If the task can fail, say what failed and offer a retry next to the bar.

Alternatives

  • Spinner — Indeterminate work of unknown duration.
  • Skeleton — Content loading whose layout is known.
  • Slider — A value people set themselves.
  • Chart — Comparing quantities rather than completion.

Resources