Get Started
Input
Feedback
Display
Installation
i18n
Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
x
"use client"
import * as React from "react"Installation#
pnpm dlx shadcn@latest add https://ui.tyap.me/r/styles/base/progress.jsonnpx shadcn@latest add https://ui.tyap.me/r/styles/base/progress.jsonyarn dlx shadcn@latest add https://ui.tyap.me/r/styles/base/progress.jsonbunx --bun shadcn@latest add https://ui.tyap.me/r/styles/base/progress.json
Install the following dependencies:
pnpm add @base-ui/reactnpm install @base-ui/reactyarn add @base-ui/reactbun add @base-ui/react
Copy and paste the following code into your project.
"use client"
import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
import { cn } from "@/lib/utils"
function Progress({
className,
children,
value,
...props
}: ProgressPrimitive.Root.Props) {
return (
<ProgressPrimitive.Root
value={value}
data-slot="progress"
className={cn("flex flex-wrap gap-3", className)}
{...props}
>
{children}
<ProgressTrack>
<ProgressIndicator />
</ProgressTrack>
</ProgressPrimitive.Root>
)
}
function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
return (
<ProgressPrimitive.Track
className={cn(
"relative flex w-full items-center overflow-x-hidden",
className
)}
data-slot="progress-track"
{...props}
/>
)
}
function ProgressIndicator({
className,
...props
}: ProgressPrimitive.Indicator.Props) {
return (
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
className={cn("h-full transition-all", className)}
{...props}
/>
)
}
function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
return (
<ProgressPrimitive.Label
className={cn(className)}
data-slot="progress-label"
{...props}
/>
)
}
function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
return (
<ProgressPrimitive.Value
className={cn(className)}
data-slot="progress-value"
{...props}
/>
)
}
export {
Progress,
ProgressTrack,
ProgressIndicator,
ProgressLabel,
ProgressValue,
}
Update the import paths to match your project setup.
Usage#
import { Progress } from "@/components/ui/progress"<Progress value={33} />Composition#
With label and value#
Use ProgressLabel and ProgressValue to add a label and value display.
import {
Progress,
ProgressLabel,
ProgressValue,
} from "@/components/ui/progress"
;<Progress value={56} className="w-full max-w-sm">
<ProgressLabel>Upload progress</ProgressLabel>
<ProgressValue />
</Progress>Progress
├── ProgressLabel
├── ProgressValue
└── ProgressTrack
└── ProgressIndicatorExamples#
Label#
Use ProgressLabel and ProgressValue to add a label and value display.
Upload progress56%
x
import {
Progress,
ProgressLabel,Controlled#
A progress bar that can be controlled by a slider.
x
"use client"
import * as React from "react"RTL#
To enable RTL support in shadcn/ui, see the RTL configuration guide.
تقدم الرفع٥٦%
x
"use client"
import * as React from "react"API Reference#
See the Base UI Progress documentation.