content logo

React Progress Bars:

React Circular Progress Bar with Range Element

If you would like to have a beautiful progress bar on your website, pay attention to this post carefully. In this post, we have put the React Circular Progress Bar with Range Element in attractive colors. This Progress Bar Range is a great idea for online shops where the seller wants to show the available products to the customer. You can use this Simple Progress Bar Code on all kinds of websites since it fits different themes. This post is a great idea for different websites.

This React Progress Bar Code has a white background with a large title at the top of the page. Then, you can see two progress buttons in a circle shape with a field that increases or decreases the progress bars. The circle that is located on the right side has a green color and the left side is red. You can see different texts and numbers in these circles. As you move the middle field, one circle increases, and the other one decreases. Plus, the color around these circles increases or decreases such as numbers. You can use this Decremental Circular Progress Bar for different reasons and increase the beauty of your website.

 

#

Simple Progress Bar Code

#

Decremental Circular Progress Bar

#

React Progress Bar Code

#

Progress Bar Range

<!-- This script got from frontendfreecode.com -->
<h2>React Round Progress Bar</h2>
<div id="root"></div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
@import url('https://fonts.googleapis.com/css?family=Varela+Round');
body {
  font-family: 'Varela Round', sans-serif;
}
function RoundProgressBar(props) {
  const size = props.size;
  const radius = (props.size - props.strokeWidth) / 2;
  const viewBox = `0 0 ${size} ${size}`;
  const dashArray = radius * Math.PI * 2;
  const dashOffset = dashArray - dashArray * props.value / props.max;
  const percentage = (props.value / props.max * 100).toFixed();
  return /*#__PURE__*/(
    React.createElement("svg", {
      width: props.size,
      height: props.size,
      viewBox: viewBox }, /*#__PURE__*/
    React.createElement("circle", {
      fill: 'none',
      stroke: '#ddd',
      cx: props.size / 2,
      cy: props.size / 2,
      r: radius,
      strokeWidth: `${props.strokeWidth}px` }), /*#__PURE__*/
    React.createElement("circle", {
      fill: 'none',
      stroke: props.stroke,
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeDasharray: dashArray,
      strokeDashoffset: dashOffset,
      cx: props.size / 2,
      cy: props.size / 2,
      r: radius,
      strokeWidth: `${props.strokeWidth}px`,
      transform: `rotate(-90 ${props.size / 2} ${props.size / 2})` }), /*#__PURE__*/
    React.createElement("text", {
      x: "55%",
      y: "50%",
      dy: "0.4rem",
      textAnchor: "end",
      fill: props.stroke,
      style: {
        fontSize: '2.5rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    `${props.value}`), /*#__PURE__*/
    React.createElement("text", {
      x: "55%",
      y: "50%",
      dy: ".4rem",
      textAnchor: "start",
      fill: props.stroke,
      style:
      {
        fontSize: '1.4rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    `/${props.max}`), /*#__PURE__*/
    React.createElement("text", {
      x: "50%",
      y: "50%",
      dy: "1.5rem",
      textAnchor: "middle",
      fill: props.stroke,
      style:
      {
        fontSize: '1rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    props.text), /*#__PURE__*/
    React.createElement("text", {
      x: "50%",
      y: "50%",
      dy: "2.7rem",
      textAnchor: "middle",
      fill: props.stroke,
      style:
      {
        fontSize: '1rem',
        fontFamily: 'Varela Round' } },
    `${percentage}%`)));
}
RoundProgressBar.defaultProps = {
  size: 200,
  value: 25,
  max: 100,
  strokeWidth: 10,
  stroke: 'red',
  text: "" };
class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      percentage: 25 };
    this.handleChangeEvent = this.handleChangeEvent.bind(this);
  }
  handleChangeEvent(event) {
    this.setState({
      percentage: event.target.value });
  }
  render() {
    return /*#__PURE__*/(
      React.createElement("div", null, /*#__PURE__*/
      React.createElement("div", { style: { display: 'flex', justifyContent: 'space-around' } }, /*#__PURE__*/
      React.createElement(RoundProgressBar, {
        value: this.state.percentage,
        stroke: '#b9332f',
        max: 210,
        text: "UNAVAILABLE" }), /*#__PURE__*/
      React.createElement("div", null, /*#__PURE__*/
      React.createElement("h3", null, "Click Me! \u2193"), /*#__PURE__*/
      React.createElement("input", {
        id: "progressInput",
        type: "range",
        min: "0",
        max: "210",
        step: "1",
        value: this.state.percentage,
        onChange: this.handleChangeEvent })), /*#__PURE__*/
      React.createElement(RoundProgressBar, {
        value: 210 - this.state.percentage,
        stroke: '#73bc8d',
        max: 210,
        text: "AVAILABLE" }))));
  }}
ReactDOM.render( /*#__PURE__*/
React.createElement(App, null),
document.querySelector('#root'));
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js'></script>
<style>
@import url('https://fonts.googleapis.com/css?family=Varela+Round');
body {
  font-family: 'Varela Round', sans-serif;
}
</style>

</head>
<body>
<h2>React Round Progress Bar</h2>
<div id="root"></div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
function RoundProgressBar(props) {
  const size = props.size;
  const radius = (props.size - props.strokeWidth) / 2;
  const viewBox = `0 0 ${size} ${size}`;
  const dashArray = radius * Math.PI * 2;
  const dashOffset = dashArray - dashArray * props.value / props.max;
  const percentage = (props.value / props.max * 100).toFixed();
  return /*#__PURE__*/(
    React.createElement("svg", {
      width: props.size,
      height: props.size,
      viewBox: viewBox }, /*#__PURE__*/
    React.createElement("circle", {
      fill: 'none',
      stroke: '#ddd',
      cx: props.size / 2,
      cy: props.size / 2,
      r: radius,
      strokeWidth: `${props.strokeWidth}px` }), /*#__PURE__*/
    React.createElement("circle", {
      fill: 'none',
      stroke: props.stroke,
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeDasharray: dashArray,
      strokeDashoffset: dashOffset,
      cx: props.size / 2,
      cy: props.size / 2,
      r: radius,
      strokeWidth: `${props.strokeWidth}px`,
      transform: `rotate(-90 ${props.size / 2} ${props.size / 2})` }), /*#__PURE__*/
    React.createElement("text", {
      x: "55%",
      y: "50%",
      dy: "0.4rem",
      textAnchor: "end",
      fill: props.stroke,
      style: {
        fontSize: '2.5rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    `${props.value}`), /*#__PURE__*/
    React.createElement("text", {
      x: "55%",
      y: "50%",
      dy: ".4rem",
      textAnchor: "start",
      fill: props.stroke,
      style:
      {
        fontSize: '1.4rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    `/${props.max}`), /*#__PURE__*/
    React.createElement("text", {
      x: "50%",
      y: "50%",
      dy: "1.5rem",
      textAnchor: "middle",
      fill: props.stroke,
      style:
      {
        fontSize: '1rem',
        fontFamily: 'Varela Round',
        fontWeight: 'bold' } },
    props.text), /*#__PURE__*/
    React.createElement("text", {
      x: "50%",
      y: "50%",
      dy: "2.7rem",
      textAnchor: "middle",
      fill: props.stroke,
      style:
      {
        fontSize: '1rem',
        fontFamily: 'Varela Round' } },
    `${percentage}%`)));
}
RoundProgressBar.defaultProps = {
  size: 200,
  value: 25,
  max: 100,
  strokeWidth: 10,
  stroke: 'red',
  text: "" };
class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      percentage: 25 };
    this.handleChangeEvent = this.handleChangeEvent.bind(this);
  }
  handleChangeEvent(event) {
    this.setState({
      percentage: event.target.value });
  }
  render() {
    return /*#__PURE__*/(
      React.createElement("div", null, /*#__PURE__*/
      React.createElement("div", { style: { display: 'flex', justifyContent: 'space-around' } }, /*#__PURE__*/
      React.createElement(RoundProgressBar, {
        value: this.state.percentage,
        stroke: '#b9332f',
        max: 210,
        text: "UNAVAILABLE" }), /*#__PURE__*/
      React.createElement("div", null, /*#__PURE__*/
      React.createElement("h3", null, "Click Me! \u2193"), /*#__PURE__*/
      React.createElement("input", {
        id: "progressInput",
        type: "range",
        min: "0",
        max: "210",
        step: "1",
        value: this.state.percentage,
        onChange: this.handleChangeEvent })), /*#__PURE__*/
      React.createElement(RoundProgressBar, {
        value: 210 - this.state.percentage,
        stroke: '#73bc8d',
        max: 210,
        text: "AVAILABLE" }))));
  }}
ReactDOM.render( /*#__PURE__*/
React.createElement(App, null),
document.querySelector('#root'));
</script>

</body>
</html>
Preview