Skip to Content
Zuri
Components

Progress

A determinate or indeterminate progress bar.

Live preview
Theme
Preview width

Use Progress when you can say how far along something is, such as an upload or a step in a flow. When you can't, leave out value for an indeterminate bar, or use a Spinner.

Installation

pnpm dlx shadcn@latest add https://components.abdulqadirmsingi.com/r/progress.json

Usage

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

<Progress aria-label="Uploading receipt" value={35} />

Props

Progress extends native <div> props (except children) and spreads them onto the track, including ref (React 19).

Props
PropTypeDefaultDescription
valuenumber–Current value from 0 to max. Out-of-range values are clamped. Omit (or pass NaN) for indeterminate.
maxnumber100The value that means complete.
aria-labelstring–Required unless you use aria-labelledby: the bar needs a name.

Accessibility

  • It has role="progressbar" with aria-valuemin, aria-valuemax and aria-valuenow. When indeterminate, aria-valuenow is left out, which is how assistive technology knows the length is unknown.
  • It does not announce every change. For long tasks, also announce milestones in a live region.
  • The bar slides with a transform and mirrors in right-to-left layouts. Indeterminate pulses rather than moves, so there is nothing to turn off for reduced motion.

Tokens used

--muted, --primary, --duration-base, --ease-out.

Known limitations

  • No label or percentage text is drawn for you.
  • Indeterminate state is a pulse, not a travelling stripe.

Source

import type { ComponentProps } from "react";import { cn } from "@/lib/utils";export interface ProgressProps extends Omit<ComponentProps<"div">, "children"> {  /** Current value from 0 to `max`. Omit for an indeterminate (unknown length) state. */  value?: number;  /** Value that means "complete". Defaults to 100. */  max?: number;}/** * A progress bar with `role="progressbar"`. It needs a name: pass `aria-label` or * `aria-labelledby`. Without a `value` it is indeterminate and pulses (no movement). */export function Progress({ value, max = 100, className, ...props }: ProgressProps) {  const known = typeof value === "number" && Number.isFinite(value) && max > 0;  const clamped = known ? Math.min(Math.max(value, 0), max) : undefined;  const fraction = clamped === undefined ? 1 : clamped / max;  return (    <div      role="progressbar"      aria-valuemin={0}      aria-valuemax={max}      aria-valuenow={clamped}      className={cn("h-2 w-full overflow-hidden rounded-full bg-muted", className)}      {...props}    >      {/* Slides with transform (cheap to animate); mirrored in right-to-left layouts. */}      <div        className={cn(          "h-full w-full rounded-full bg-primary transition-transform duration-[var(--duration-base)] ease-[var(--ease-out)] motion-reduce:transition-none",          "-translate-x-[calc((1-var(--zuri-progress))*100%)] rtl:translate-x-[calc((1-var(--zuri-progress))*100%)]",          clamped === undefined && "animate-pulse motion-reduce:animate-pulse",        )}        style={{ "--zuri-progress": fraction } as React.CSSProperties}      />    </div>  );}

On this page