Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Trace
- Typography
AI Elements
Get Started
@shadcn/react
@shadcn/helpers
Utilities
"use client"
import * as React from "react""use client"
import * as React from "react"
import { Progress } from "@/components/ui/progress"
export function ProgressDemo() {
const [progress, setProgress] = React.useState(13)
React.useEffect(() => {
const timer = setTimeout(() => setProgress(66), 500)
return () => clearTimeout(timer)
}, [])
return <Progress value={progress} className="w-[60%]" />
}
Installation#
pnpm dlx shadcn@latest add progress
Install the following dependencies:
pnpm add radix-ui
Copy and paste the following code into your project.
"use client"
import * as React from "react"
import { cn } from "cn"
import { Progress as ProgressPrimitive } from "radix-ui"
function Progress({
className,
value,
...props
}: React.ComponentProps<typeof ProgressPrimitive.Root>) {
return (
<ProgressPrimitive.Root
data-slot="progress"
className={cn(
"relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",
className
)}
{...props}
>
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
className="size-full flex-1 bg-primary transition-all"
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
)
}
export { Progress }
Update the import paths to match your project setup.
Usage#
import { Progress } from "@/components/ui/progress"<Progress value={33} />Label#
Use a Field component to add a label to the progress bar.
import { Field, FieldLabel } from "@/components/ui/field"
import { Progress } from "@/components/ui/progress"
import { Field, FieldLabel } from "@/components/ui/field"
import { Progress } from "@/components/ui/progress"
export function ProgressWithLabel() {
return (
<Field className="w-full max-w-sm">
<FieldLabel htmlFor="progress-upload">
<span>Upload progress</span>
<span className="ml-auto">66%</span>
</FieldLabel>
<Progress value={66} id="progress-upload" />
</Field>
)
}
Controlled#
A progress bar that can be controlled by a slider.
"use client"
import * as React from "react""use client"
import * as React from "react"
import { Progress } from "@/components/ui/progress"
import { Slider } from "@/components/ui/slider"
export function ProgressControlled() {
const [value, setValue] = React.useState([50])
return (
<div className="flex w-full max-w-sm flex-col gap-4">
<Progress value={value[0]} />
<Slider
value={value}
onValueChange={setValue}
min={0}
max={100}
step={1}
/>
</div>
)
}
RTL#
To enable RTL support in shadcn/ui, see the RTL configuration guide.
"use client"
import * as React from "react"// You will notice this example uses dir and data-lang attributes. // This is because this site is not RTL by default. // In your application, you won't need these.// See the RTL guide for more information.
"use client"
import * as React from "react"
import {
useTranslation,
type Translations,
} from "@/components/language-selector"
import { Field, FieldLabel } from "@/components/ui/field"
import { Progress } from "@/components/ui/progress"
const translations: Translations = {
en: {
dir: "ltr",
values: {
label: "Upload progress",
},
},
ar: {
dir: "rtl",
values: {
label: "تقدم الرفع",
},
},
he: {
dir: "rtl",
values: {
label: "התקדמות העלאה",
},
},
}
function toArabicNumerals(num: number): string {
const arabicNumerals = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"]
return num
.toString()
.split("")
.map((digit) => arabicNumerals[parseInt(digit, 10)])
.join("")
}
export function ProgressRtl() {
const { dir, t, language } = useTranslation(translations, "ar")
const formatNumber = (num: number): string => {
if (language === "ar") {
return toArabicNumerals(num)
}
return num.toString()
}
return (
<Field className="w-full max-w-sm" dir={dir}>
<FieldLabel htmlFor="progress-upload">
<span>{t.label}</span>
<span className="ms-auto">{formatNumber(66)}%</span>
</FieldLabel>
<Progress value={66} id="progress-upload" className="rtl:rotate-180" />
</Field>
)
}
API Reference#
See the Radix UI Progress documentation.
Deploy your shadcn/ui app on Vercel
Trusted by OpenAI, Sonos, Adobe, and more.
Vercel provides tools and infrastructure to deploy apps and features at scale.
Deploy to Vercel