A comprehensive React component library for displaying progress indicators with multiple styles and configurations. Built with TypeScript, styled with design tokens, and fully accessible.
- Multiple Progress Components: Linear, Circular, Vertical, Segmented, Step, and Spinner variants
- Fully Accessible: ARIA attributes and semantic HTML for screen readers
- Design Token Integration: Uses
@asafarim/design-tokensfor consistent styling - TypeScript Support: Full type safety with exported interfaces
- Flexible Styling: CSS Modules with customizable sizes, tones, and animations
- React 18+: Built for modern React with hooks support
npm install @asafarim/progress-barsor with pnpm:
pnpm add @asafarim/progress-bars- Live Demo: https://alisafari-it.github.io/progress-bars/
- Interactive Playground: Test components with live configuration
- Accessibility Examples: See ARIA implementations
- Visual Grid: Compare all variants and styles
import { LinearProgress } from '@asafarim/progress-bars';
import '@asafarim/progress-bars/dist/style.css';
export function MyComponent() {
return (
<>
{/* Determinate progress */}
<LinearProgress value={65} />
{/* Indeterminate loading state */}
<LinearProgress variant="indeterminate" />
{/* With striped animation */}
<LinearProgress value={45} striped animated />
</>
);
}import { CircularProgress } from '@asafarim/progress-bars';
export function MyComponent() {
return (
<>
{/* Determinate circular progress */}
<CircularProgress value={75} size={80} showLabel />
{/* Indeterminate spinner */}
<CircularProgress size={56} />
</>
);
}Horizontal progress bar with determinate and indeterminate variants.
Props:
variant?: 'determinate' | 'indeterminate'- Progress type (default:'determinate')size?: 'sm' | 'md' | 'lg'- Bar height (default:'md')tone?: ProgressTone- Color tone (default:'brand')value?: number- Current progress value (0-100, default:0)min?: number- Minimum value (default:0)max?: number- Maximum value (default:100)striped?: boolean- Show striped pattern (default:false)animated?: boolean- Animate stripes (default:false)thickness?: number- Custom track height in pixelsariaLabel?: string- Accessible nameariaLabelledBy?: string- ID of labeling elementariaValueText?: string- Text for indeterminate state (default:'Loading')
Usage Example:
<LinearProgress
value={60}
size="lg"
tone="success"
striped
animated
ariaLabel="File upload progress"
/>Circular progress indicator with optional label overlay.
Props:
value?: number- Progress percentage (0-100, undefined for indeterminate)size?: number- SVG size in pixels (default:56)thickness?: number- Stroke width in pixels (default:6)tone?: ProgressTone- Color tone (default:'brand')label?: string- Accessible labelshowLabel?: boolean- Display percentage text (default:false)formatValue?: (value: number) => string- Custom value formatter
Usage Example:
<CircularProgress
value={85}
size={120}
thickness={8}
tone="success"
showLabel
formatValue={(v) => `${v}%`}
/>Vertical progress bar (similar to LinearProgress but vertical orientation).
Props: Same as LinearProgress
Example:
<VerticalProgress value={50} size="lg" />Progress bar divided into discrete segments.
Props:
value?: number- Current progress valuesegments?: number- Number of segments (default:5)tone?: ProgressTone- Color tonesize?: 'sm' | 'md' | 'lg'- Bar size
Example:
<SegmentedProgress value={3} segments={5} />Multi-step progress indicator showing completion status.
Props:
steps?: Array<{ label: string; completed?: boolean }>- Step definitionscurrentStep?: number- Current active steptone?: ProgressTone- Color tone
Example:
<StepProgress
steps={[
{ label: 'Step 1', completed: true },
{ label: 'Step 2', completed: true },
{ label: 'Step 3' }
]}
currentStep={2}
/>Animated loading spinner.
Props:
size?: number- Size in pixels (default:40)tone?: ProgressTone- Color toneariaLabel?: string- Accessible label
Example:
<Spinner size={48} tone="brand" ariaLabel="Loading" />Base component for custom progress implementations.
Label component for progress indicators.
Legend component for displaying progress information.
Container for stacking multiple progress components.
Available color tones (from design tokens):
'brand'- Primary brand color'success'- Success/positive state'warning'- Warning state'error'- Error/negative state'info'- Informational state
The package uses CSS Modules and design tokens for styling. Import the styles:
import '@asafarim/progress-bars/dist/style.css';Styles are automatically scoped to components and use CSS custom properties from @asafarim/design-tokens.
All components include:
- Proper ARIA roles and attributes
- Semantic HTML structure
- Keyboard navigation support
- Screen reader friendly labels
- Color-independent progress indication
Example with accessibility:
<LinearProgress
value={50}
ariaLabel="Download progress"
ariaLabelledBy="progress-label"
/>
<div id="progress-label">Downloading file...</div>Full TypeScript support with exported types:
import type {
LinearProgressProps,
CircularProgressProps,
ProgressTone
} from '@asafarim/progress-bars';- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
MIT
Ali Safari ali@asafarim.com