Create a Custom Circular Progress Bar with React and Tailwind CSS

Graphs and charts offer the most visually appealing and effective ways of presenting data, and the Circular Progress Bar is a modern and engaging way to represent progress.

In this document, you'll get a customizable Circular Progress Bar component made with React and Tailwind CSS, helping you enhance your UI with minimal effort.

Circular Progress Bar UI

Tailwind Circular Progress Bar

React and Tailwind CSS Circular Progress Bar Component

This Circular Progress Bar component is built with React and styled using Tailwind CSS. It allows for easy customization with three key props:

  1. strokeWidth: thickness of the bar stroke.
  2. sqSize: specifies the diameter of the circle.
  3. percentage: the progress percentage, determine how much to fill.

Feel free to modify these props to fit your specific needs.

Component Code

0%

How to Implement the Circular Progress Bar Component

  • To test the component, I've created an onChangeProgress method, which will update the progress to 20% on each click.

Circular Progress Bar with Timer

The TimerCircularProgressBar is a React functional component that visually represents a countdown timer using an SVG-based circular progress bar. It gradually decreases from 100% to 0% over a specified duration.

Props

  • strokeWidth (optional, number): Defines the thickness of the circular progress bar. Default is 8.
  • sqSize (optional, number): Specifies the width and height of the SVG container. Default is 180.
  • duration (optional, number): Total countdown duration in seconds. Default is 120.

How It Works

  • The component maintains a percentage state, starting at 100% and decreasing every second.
  • It calculates the stroke dash offset dynamically to animate the circular progress.
  • The remaining time (in seconds) is displayed at the center of the circle.

Timer ProgressBar UI

Tailwind circular progressbar with timer

Component Code

120s

If you're looking for a countdown timer with a circular progress bar for a coming soon page, you can find it here.

If you find this guide helpful, please let me know your thoughts. Your feedback encourages me to create more useful components for the community.

React Lessons You Can Implement Today

Real coding lessons, AI workflows, and teaching insights. No fluff, just what works.

MediumFollow me on Medium