shadcn.io is not affiliated with official shadcn/ui
Shadcn Progress for React
Displays task progress with a linear indicator.
Installation
bunx --bun shadcn@latest add https://kit.dev/r/aria/progress.jsonnpx shadcn@latest add https://kit.dev/r/aria/progress.jsonpnpm dlx shadcn@latest add https://kit.dev/r/aria/progress.jsonyarn shadcn@latest add https://kit.dev/r/aria/progress.jsonInstall the following dependencies:
bun add react-aria-componentsnpm install react-aria-componentspnpm add react-aria-componentsyarn add react-aria-componentsCopy and paste the following code into your project.
"use client";
import type React from "react";
import { createContext, useContext, useMemo } from "react";
import {
Label as LabelPrimitive,
type LabelProps,
ProgressBar as ProgressPrimitive,
type ProgressBarProps as ProgressPrimitiveProps,
} from "react-aria-components";
import { cn } from "@/lib/utils";
interface ProgressContextValue {
isIndeterminate: boolean;
percentage?: number;
valueText?: string;
}
Update the import paths to match your project setup.
Anatomy
Progress
├── ProgressLabel
├── ProgressTrack
├── ProgressIndicator
├── ProgressValue
├── ProgressView
└── ProgressCircle
├── ProgressCircleTrack
└── ProgressCircleRangeUsage
import { useEffect, useState } from "react";
import { Progress } from "@/components/ui/progress";const ProgressDemo = () => {
const [progress, setProgress] = useState(13);
useEffect(() => {
const timer = setTimeout(() => setProgress(66), 500);
return () => clearTimeout(timer);
}, []);
return <Progress className="w-[60%]" value={progress} />;
};Demos
Label
Use ProgressLabel and ProgressValue to add a label and value display.
Controlled
A progress bar that can be controlled by a slider.
Rtl
Right-to-left progress. See the RTL configuration guide for document direction.
API Reference
Progress
PropType
AttributeType
ProgressTrack
PropType
AttributeType
ProgressIndicator
PropType
AttributeType
ProgressRange
AttributeType
ProgressLabel
PropType
elementType?stringAttributeType
ProgressValue
PropType
AttributeType