Components
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- Dialog
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Label
- Menu
- Meter
- Number Field
- Pagination
- Popover
- Preview Card
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Slider
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Resources
Progress
Displays the status of a task that takes a long time.
"use client"
import * as React from "react"
import { Progress } from "@/components/ui/progress"
export function ProgressDemo() {
const [value, setValue] = React.useState(20)
React.useEffect(() => {
const interval = setInterval(() => {
setValue((current) =>
Math.min(100, Math.round(current + Math.random() * 25))
)
}, 1000)
return () => clearInterval(interval)
}, [])
return <Progress value={value} />
}
Installation
pnpm dlx shadcn@latest add https://coss.com/ui/r/progress.json
Usage
import {
Progress,
ProgressLabel,
ProgressValue,
} from "@/components/ui/progress"
<Progress value={40} />
Note: If you render children inside Progress
, you must also include ProgressTrack
and ProgressIndicator
inside it. Without them, the bar will not display. When no children are provided, a default track and indicator are rendered for you.
Examples
With Label and Value
Export data60%
import {
Progress,
ProgressIndicator,
ProgressLabel,
ProgressTrack,
ProgressValue,
} from "@/components/ui/progress"
export function ProgressWithLabelValueDemo() {
return (
<Progress value={60}>
<div className="flex items-center justify-between gap-2">
<ProgressLabel>Export data</ProgressLabel>
<ProgressValue />
</div>
<ProgressTrack>
<ProgressIndicator />
</ProgressTrack>
</Progress>
)
}
With Formatted Value
Upload502 / 512
"use client"
import {
Progress,
ProgressIndicator,
ProgressLabel,
ProgressTrack,
ProgressValue,
} from "@/components/ui/progress"
export function ProgressWithFormattedValueDemo() {
return (
<Progress value={502} max={512}>
<div className="flex items-center justify-between gap-2">
<ProgressLabel>Upload</ProgressLabel>
<ProgressValue>{(_formatted, value) => `${value} / 512`}</ProgressValue>
</div>
<ProgressTrack>
<ProgressIndicator />
</ProgressTrack>
</Progress>
)
}
Comparing with Radix / shadcn
If you’re already familiar with Radix UI and shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss.com ui quickly.
Quick Checklist
- Prefer
ProgressLabel
andProgressValue
for label/value instead of inline elements - If you render children inside
Progress
, you must includeProgressTrack
andProgressIndicator
(otherwise the bar will not display). Without children, a default bar is rendered for you - If you used
asChild
, switch to therender
prop
Additional Notes
Base UI introduces separate parts — ProgressLabel
, ProgressValue
, ProgressTrack
, and ProgressIndicator
— which you compose inside Progress
for greater flexibility.