shadcn.io is not affiliated with official shadcn/ui
Shadcn Progress for React
Displays task progress with a linear indicator.
x
Installation
bunx --bun shadcn@latest add https://kit.dev/r/base/progress.jsonnpx shadcn@latest add https://kit.dev/r/base/progress.jsonpnpm dlx shadcn@latest add https://kit.dev/r/base/progress.jsonyarn shadcn@latest add https://kit.dev/r/base/progress.jsonInstall the following dependencies:
bun add @base-ui/reactnpm install @base-ui/reactpnpm add @base-ui/reactyarn add @base-ui/reactCopy and paste the following code into your project.
"use client";
import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
import { cn } from "@/lib/utils";
export const Progress = (props: ProgressPrimitive.Root.Props) => {
const { className, children, value, ...rest } = props;
return (
<ProgressPrimitive.Root
className={cn("cn-progress-root flex flex-wrap gap-3", className)}
data-slot="progress"
value={value}
{...rest}
>
{children}
<ProgressTrack>
<ProgressIndicator />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
AttributeType
ProgressLabel
span
PropType
AttributeType
ProgressTrack
div
PropType
AttributeType
ProgressIndicator
div
PropType
AttributeType
ProgressRange
PropType
AttributeType
ProgressValue
span
PropType
AttributeType