content logo

React Progress Bars:

Random Percentage for React Progress Bar

If you are looking for a different code to use on your website, this post can be helpful for you. This is a Random Percentage for React Progress Bar with a beautiful style that you can use to change the design of your page. This React Progress Bar Code shows the progression of your website randomly, and because of that, many people use this code to predict their progression. So, if you want to have an attractive website to gain more followers and viewers all the time, this Responsive Progress Bar can be useful.

If you want to realize the performance of this Simple Javascript Progress Bar, you can look at its preview below. As you see, it is a simple code with two fields. The main field has a gray background that shows your progression with green color. There is a line above this field, and you can see a button with a gray background that shows your progress. Whenever you click on this button, the progression changes, and you can see different amounts of green colors. After pressing this bottom,  the Progress Random Percentage shifts smoothly. After all, it can be called four different kinds of websites.

#

React Progress Bar Code

#

Responsive Progress Bar

#

Simple Javascript Progress Bar

#

Progress Random Percentage

<!-- This script got from frontendfreecode.com -->
<div id="root"></div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
.progressbar .progress {
  background-color: green;
  border-radius: 4px;
  transition: width 400ms ease-in-out;
  height: 100%;
}
.progressbar {
  width: 100%;
  height: 30px;
  border-radius: 4px;
  background-color: lightgrey;
  padding: 10px;
}
#root {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
#App {
  width: 70%;
  height: 100%;
  margin: 10px;
}
const ProgressBar = ({ progress }) => /*#__PURE__*/
React.createElement("div", { className: "progressbar" }, /*#__PURE__*/
React.createElement("div", { className: "progress", style: { width: `${progress}%` } }));
class App extends React.Component {
  constructor(props) {
    super(props);
    this.handleClick = this.handleClick.bind(this);
    this.state = { progress: 10 };
  }
  handleClick() {
    this.setState({ progress: Math.random() * 100 + 1 });
  }
  render() {
    return /*#__PURE__*/(
      React.createElement("div", { id: "App" }, /*#__PURE__*/
      React.createElement("button", { type: "button", onClick: this.handleClick }, "Change Progress"), /*#__PURE__*/
      React.createElement("hr", null), /*#__PURE__*/
      React.createElement(ProgressBar, { progress: this.state.progress })));
  }}
ReactDOM.render( /*#__PURE__*/React.createElement(App, null), document.getElementById("root"));
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react-dom.min.js'></script>
<style>
.progressbar .progress {
  background-color: green;
  border-radius: 4px;
  transition: width 400ms ease-in-out;
  height: 100%;
}
.progressbar {
  width: 100%;
  height: 30px;
  border-radius: 4px;
  background-color: lightgrey;
  padding: 10px;
}
#root {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
#App {
  width: 70%;
  height: 100%;
  margin: 10px;
}
</style>

</head>
<body>
<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>
const ProgressBar = ({ progress }) => /*#__PURE__*/
React.createElement("div", { className: "progressbar" }, /*#__PURE__*/
React.createElement("div", { className: "progress", style: { width: `${progress}%` } }));
class App extends React.Component {
  constructor(props) {
    super(props);
    this.handleClick = this.handleClick.bind(this);
    this.state = { progress: 10 };
  }
  handleClick() {
    this.setState({ progress: Math.random() * 100 + 1 });
  }
  render() {
    return /*#__PURE__*/(
      React.createElement("div", { id: "App" }, /*#__PURE__*/
      React.createElement("button", { type: "button", onClick: this.handleClick }, "Change Progress"), /*#__PURE__*/
      React.createElement("hr", null), /*#__PURE__*/
      React.createElement(ProgressBar, { progress: this.state.progress })));
  }}
ReactDOM.render( /*#__PURE__*/React.createElement(App, null), document.getElementById("root"));
</script>

</body>
</html>
Preview