The Progress component is a visual indicator that shows the completion status of a task or process. It provides users with clear feedback about how much of a process has been completed and how much remains.
import { Progress } from '@dashflowx/core'export default function ProgressExample() {return (<Progressprogress={75}className="w-full"/>)}
Preview:
| Prop | Type | Default | Description |
|---|---|---|---|
progress | number | 0 | The progress value (0-100) |
className | string | '' | Additional CSS classes for styling |
<Progressprogress={50}className="w-full"/>
Preview:
<Progressprogress={90}className="w-full"/>
Preview:
<Progressprogress={25}className="w-full"/>
Preview:
<Progressprogress={100}className="w-full"/>
Preview:
<div className="space-y-2"><div className="flex justify-between text-sm"><span>Uploading file...</span><span>{uploadProgress}%</span></div><Progressprogress={uploadProgress}className="w-full"/></div>
<div className="space-y-2"><div className="flex justify-between text-sm"><span>Form Progress</span><span>{formProgress}%</span></div><Progressprogress={formProgress}className="w-full"/></div>
<div className="space-y-2"><div className="flex justify-between text-sm"><span>Loading data...</span><span>{loadingProgress}%</span></div><Progressprogress={loadingProgress}className="w-full"/></div>
<div className="space-y-2"><div className="flex justify-between text-sm"><span>Processing tasks</span><span>{taskProgress}%</span></div><Progressprogress={taskProgress}className="w-full"/></div>
Always provide clear labels and percentage indicators.
// ✅ Good - Clear progress indication<div className="space-y-2"><div className="flex justify-between text-sm"><span>Uploading document.pdf</span><span>{progress}%</span></div><Progress progress={progress} className="w-full" /></div>
Use appropriate sizing for different contexts.
// ✅ Good - Appropriate sizing<div className="space-y-4"><Progress progress={50} className="w-full h-2" /><Progress progress={75} className="w-full h-3" /><Progress progress={90} className="w-full h-4" /></div>
Use smooth transitions for better user experience.
// ✅ Good - Smooth transitions<Progressprogress={progress}className="w-full transition-all duration-300"/>
Ensure proper accessibility with ARIA attributes.
// ✅ Good - Accessible progress<Progressprogress={progress}className="w-full"aria-label={`Progress: ${progress}%`}/>
Use different colors for different states.
// ✅ Good - Color coding<Progressprogress={progress}className={`w-full ${progress < 30 ? 'bg-red-500' : progress < 70 ? 'bg-yellow-500' : 'bg-green-500'}`}/>
You can customize the progress bar appearance using CSS classes:
<Progressprogress={progress}className="w-full h-4 bg-gray-100 rounded-full"/>
Use different colors for different progress states:
// Success state<Progressprogress={100}className="w-full bg-green-500"/>// Warning state<Progressprogress={60}className="w-full bg-yellow-500"/>// Error state<Progressprogress={20}className="w-full bg-red-500"/>
Add animations to make progress more engaging:
<Progressprogress={progress}className="w-full animate-pulse"/>
Update progress dynamically based on user actions:
const [progress, setProgress] = useState(0);const handleProgressUpdate = (newProgress: number) => {setProgress(newProgress);};// Simulate progressuseEffect(() => {const interval = setInterval(() => {setProgress(prev => {if (prev >= 100) {clearInterval(interval);return 100;}return prev + 10;});}, 500);return () => clearInterval(interval);}, []);
Use multiple progress bars for different tasks:
<div className="space-y-4"><div><div className="flex justify-between text-sm mb-1"><span>Downloading files</span><span>{downloadProgress}%</span></div><Progress progress={downloadProgress} className="w-full" /></div><div><div className="flex justify-between text-sm mb-1"><span>Processing data</span><span>{processProgress}%</span></div><Progress progress={processProgress} className="w-full" /></div></div>
Show progress with step indicators:
<div className="space-y-2"><div className="flex justify-between text-sm"><span>Step {currentStep} of {totalSteps}</span><span>{Math.round((currentStep / totalSteps) * 100)}%</span></div><Progressprogress={(currentStep / totalSteps) * 100}className="w-full"/></div>
- Skeleton: For loading placeholders
- Spinner: For loading indicators
- Badge: For status indicators
- Alert: For completion notifications
- Button: For progress controls
For the complete API reference and advanced usage patterns, see the Progress API documentation.
