Progress Ring Chart

A customizable circular progress ring component with smooth animations and flexible styling.

Installation

pnpm dlx bna-ui add progress-ring-chart

Usage

import { ProgressRingChart } from '@/components/charts/progress-ring-chart';
<ProgressRingChart
  progress={75}
  size={120}
  strokeWidth={8}
  config={{
    animated: true,
    duration: 1000,
    gradient: true,
  }}
/>

Examples

Basic Progress Ring

Sample Progress Ring

Styled Progress Ring

Large Progress Ring

API Reference

ProgressRingChart

A customizable circular progress ring component with smooth animations and flexible styling. Perfect for displaying progress, completion rates, or any percentage-based data.

PropTypeDefaultDescription
progressnumber-Progress value from 0 to 100.
sizenumber120Size of the progress ring in pixels.
strokeWidthnumber8Width of the progress ring stroke.
configChartConfig{}Configuration object for chart appearance.
styleViewStyle-Additional styles to apply to the chart.
showLabelbooleantrueWhether to show the label above the ring.
labelstring-Label text to display above the ring.
centerTextstring-Custom text to display in the center.

ChartConfig

PropertyTypeDefaultDescription
animatedbooleantrueWhether to animate the chart on load.
durationnumber1000Animation duration in milliseconds.
gradientbooleanfalseWhether to use gradient colors for the ring.

Features

  • Circular Design: Clean circular progress indicator
  • Smooth Animations: Built-in animations using React Native Reanimated
  • Gradient Support: Optional gradient colors for enhanced visual appeal
  • Center Text: Display custom text or percentage in the center
  • Label Support: Optional label above the progress ring
  • Theme Integration: Uses theme colors for consistent styling
  • Responsive: Automatically adapts to different sizes

Use Cases

Progress ring charts are particularly effective for:

  • Progress Tracking: Displaying completion rates, loading progress
  • Performance Metrics: Showing KPIs, scores, or achievements
  • Goal Tracking: Visualizing progress towards targets
  • Health Metrics: Displaying fitness goals, step counters
  • Dashboard Widgets: Compact progress indicators for dashboards

Design Considerations

The circular design of the ProgressRingChart makes it ideal for:

  • Compact Displays: Efficient use of space with circular design
  • Dashboard Widgets: Perfect for small dashboard components
  • Mobile Interfaces: Works well on small screens
  • Visual Hierarchy: Draws attention to important metrics
  • Progress Visualization: Intuitive representation of completion

Accessibility

The ProgressRingChart component includes several accessibility features:

  • Semantic SVG structure for screen readers
  • Proper contrast ratios for visual elements
  • Text labels for progress values
  • Supports dynamic text sizing
  • Keyboard navigation support

Performance

The component is optimized for performance:

  • Uses React Native Reanimated for smooth 60fps animations
  • Efficient SVG rendering with minimal re-renders
  • Automatic cleanup of animation values
  • Lightweight circular path calculations

Styling

The component integrates with your theme system:

  • Uses primary color from theme for default ring color
  • Uses mutedForeground color for labels and text
  • Supports gradient colors for enhanced visual appeal
  • Rounded stroke caps for modern appearance

Animation

The chart features smooth entry animations:

  • Ring animates from 0% to target progress
  • Configurable animation duration
  • Can be disabled for instant rendering
  • Uses React Native Reanimated for optimal performance

Customization

The progress ring can be customized in various ways:

  • Size: Adjust the overall size of the ring
  • Stroke Width: Control the thickness of the ring
  • Colors: Use theme colors or custom gradient
  • Center Content: Display percentage or custom text
  • Labels: Add descriptive labels above the ring