Skip to content
caliper ui docs

Components

Progress

A measured bar for work with a known size, such as an upload.

Free
pnpm dlx shadcn@latest add @caliper/progress

Q3 board pack

Shared with Priya Nair and Omar Aziz when it finishes

q3-board-pack.pdf36 of 120 MB

Uploading report

30%

Installs components/ui/progress.tsxDepends on lucide-reactMotion shared motion tokens

When to use

Use it for

  • You know how much is done and how much remains.
  • Uploads, imports and multi-step processing.

Skip it when

  • The total is unknown; use a loader.
  • The structure of incoming content is known; use a skeleton.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/progress

Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { FileText } from "lucide-react"
import { useEffect, useState, type ReactNode } from "react"
import { Button } from "@/components/ui/button"
import { cn } from "@/components/ui/lib/cn"
import { Progress } from "@/components/ui/progress"

function Panel({ title, context, action, className, children }: { title: string; context: string; action?: ReactNode; className?: string; children: ReactNode }) {
  return (
    <section className={cn("grid w-full max-w-md gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting", className)}>
      <div className="flex items-start justify-between gap-3">
        <div className="grid min-w-0 gap-1">
          <p className="font-medium">{title}</p>
          <p className="text-sm text-muted-foreground">{context}</p>
        </div>
        {action}
      </div>
      {children}
    </section>
  );
}

export function UploadProgress() {
  const [sent, setSent] = useState(36);
  const [paused, setPaused] = useState(false);
  const done = sent >= 120;
  useEffect(() => {
    if (paused || done) return;
    const timer = setTimeout(() => setSent((value) => Math.min(120, value + 4)), 300);
    return () => clearTimeout(timer);
  }, [sent, paused, done]);
  return (
    <Panel title="Q3 board pack" context="Shared with Priya Nair and Omar Aziz when it finishes">
      <div className="flex items-center gap-3 text-sm">
        <span aria-hidden="true" className="grid size-9 shrink-0 place-items-center rounded-control bg-muted"><FileText className="size-4" /></span>
        <span className="grid min-w-0 flex-1">
          <span className="truncate font-medium">q3-board-pack.pdf</span>
          <span className="text-muted-foreground">{done ? "120 MB · uploaded" : `${sent} of 120 MB${paused ? " · paused" : ""}`}</span>
        </span>
        <Button
          size="sm"
          variant="secondary"
          onClick={() => {
            if (done) setSent(0);
            else setPaused((value) => !value);
          }}
        >
          {done ? "Upload again" : paused ? "Resume" : "Pause"}
        </Button>
      </div>
      <Progress label="Uploading report" value={sent} max={120} showValue />
    </Panel>
  );
}

API reference

Progress

component

Also accepts the native props of its root element and a ref.

PropTypeDefault
valuenumber0
maxnumber100
labelstring—
showValuebooleanfalse

Accessibility

It exposes progressbar semantics, with aria-hidden, aria-valuemin, aria-valuemax, aria-valuenow, aria-valuetext and aria-label kept in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

Transitions use the shared duration and easing tokens. Under prefers-reduced-motion those tokens collapse to instant and travel distances go to zero, so state changes still happen without movement.

All Feedback examples