Skip to content

Progress

Progress

A progress bar component for showing completion status.

Import

import { Progress } from '@primitivekit/react';

Basic Usage

<Progress value={50} />

Sizes

<Progress size="small" value={30} />
<Progress size="medium" value={50} />
<Progress size="large" value={70} />

Color Schemes

<Progress colorScheme="primary" value={25} />
<Progress colorScheme="success" value={50} />
<Progress colorScheme="warning" value={75} />
<Progress colorScheme="danger" value={90} />

With Label

<Progress value={60} showLabel />

Striped

<Progress value={70} striped />

Animated

<Progress value={80} striped animated />

Indeterminate

<Progress indeterminate />

Props

PropTypeDefaultDescription
valuenumber0Progress value (0-100)
maxnumber100Maximum value
size'small' | 'medium' | 'large''medium'Progress bar size
colorScheme'primary' | 'success' | 'warning' | 'danger''primary'Color scheme
showLabelbooleanfalseShow percentage label
stripedbooleanfalseStriped pattern
animatedbooleanfalseAnimate stripes
indeterminatebooleanfalseIndeterminate state
classNamestring-Additional CSS classes
styleProgressCSSVariables-CSS variable overrides

Customization

<Progress
  value={65}
  style={{
    '--progress-height': '12px',
    '--progress-bg': 'rgba(230, 230, 230, 1)',
    '--progress-fill-bg': 'rgba(0, 200, 0, 1)',
    '--progress-border-radius': '10px',
  }}
/>

Examples

File Upload

function FileUpload() {
  const [progress, setProgress] = useState(0);

  const handleUpload = async (file) => {
    // Simulate upload progress
    const interval = setInterval(() => {
      setProgress(prev => {
        if (prev >= 100) {
          clearInterval(interval);
          return 100;
        }
        return prev + 10;
      });
    }, 500);
  };

  return (
    <div>
      <Progress value={progress} showLabel />
      <p>{progress === 100 ? 'Upload complete!' : 'Uploading...'}</p>
    </div>
  );
}

Multi-step Form

function MultiStepForm() {
  const [step, setStep] = useState(1);
  const totalSteps = 4;
  const progress = (step / totalSteps) * 100;

  return (
    <div>
      <Progress value={progress} showLabel />
      <p>Step {step} of {totalSteps}</p>
    </div>
  );
}

Accessibility

  • ✅ ARIA role=“progressbar”
  • ✅ aria-valuenow, aria-valuemin, aria-valuemax
  • ✅ Screen reader announcements
  • ✅ Proper labeling

Related Components