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/radix/progress.jsonnpx shadcn@latest add https://kit.dev/r/radix/progress.jsonpnpm dlx shadcn@latest add https://kit.dev/r/radix/progress.jsonyarn shadcn@latest add https://kit.dev/r/radix/progress.jsonInstall the following dependencies:
bun add radix-uinpm install radix-uipnpm add radix-uiyarn add radix-uiCopy and paste the following code into your project.
"use client";
import { Progress as ProgressPrimitive } from "radix-ui";
import type React from "react";
import { createContext, useContext } from "react";
import { cn } from "@/lib/utils";
interface ProgressContextValue {
value?: number | null;
}
const ProgressContext = createContext<ProgressContextValue>({});
export const useProgress = () => useContext(ProgressContext);
export const Progress = (
props: React.ComponentProps<typeof ProgressPrimitive.Root>
) => {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
div
PropType
valuenumber, max: number): stringmax?numberAttributeType
ProgressTrack
PropType
valuenumber, max: number): stringmax?numberAttributeType
ProgressIndicator
PropType
valuenumber, max: number): stringmax?numberAttributeType
ProgressRange
PropType
valuenumber, max: number): stringmax?numberAttributeType
ProgressLabel
PropType
valuenumber, max: number): stringmax?numberAttributeType
ProgressValue
PropType
valuenumber, max: number): stringmax?numberAttributeType