content logo

React Progress Bars:

React Progress Bar with Gradient Color and Shadow

You can use the progress bar for various reasons. These functional codes can show the progress of the website, the satisfaction of the users, the processes of doing a job, or any kind of information. So, look at the React Progress Bar with Gradient Color and Shadow and apply it to your website to improve in a short time. This Gradient Progress Bar Code is available to change the design of your website and increase the number of its users. You can use this React Progress Bar with Shadow on different kinds of websites with various themes.

We have put the preview of this code below to inform you about this HTML Progress Bar with Label. As you see here, this code includes four bars with different colors. These bars have shadow and their first parts have a darker color. All of these bars are located vertically. You can see the percentage with a black color on the right side of the bar. These percentages are placed in the fields and you can see the amount of progression easily. If you want to increase the attraction of your website, this Colorful Progress Bar Code looks like a good option.

 

#

Gradient Progress Bar Code

#

React Progress Bar with Shadow

#

HTML Progress Bar with Label

#

Colorful Progress Bar Code

<!-- 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>
                                                                            
.progress-bar-wrapper {
  margin: 10px 0;
}
.progress-bar-wrapper .progress-bar {
  min-height: 40px;
  width: 100%;
}
.progress-bar-wrapper .progress-bar .progress-bar-progress {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
  min-width: 0;
  width: 100%;
  transition: all 1s ease;
}
.progress-bar-wrapper .progress-bar .percentage {
  font-weight: bold;
  padding-right: 10px;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}
.progress-bar-wrapper .progress-bar .percentage::after {
  content: "%";
}
class ProgressBar extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            maxWidth: 0
        };
        this.targetPercentage = this.props.value / this.props.maxValue;
    }
    progressBarStyle() {
        return {
            backgroundImage:
                "linear-gradient(" +
                this.props.rotation +
                "deg, " +
                this.props.color +
                ", " +
                this.props.color2 +
                ")",
            maxWidth: this.state.maxWidth,
            backgroundColor: this.props.color,
            borderRadius: this.getRadius()
        };
    }
    componentDidMount() {
        setTimeout(
            () => this.setState({ maxWidth: this.targetPercentage * 100 + "%" }),
            10);
    }
    getRadius() {
        return (
            "5px " + (this.targetPercentage * 100 >= 100 ? "5px 5px" : "0 0") + " 5px");
    }
    render() {
        return /*#__PURE__*/(
            React.createElement("div", { className: "progress-bar-wrapper" }, /*#__PURE__*/
                React.createElement("div", { className: "progress-bar" }, /*#__PURE__*/
                    React.createElement("div", {
                        className: "progress-bar-progress",
                        style: this.progressBarStyle()
                    }, /*#__PURE__*/
                        React.createElement("div", { className: "percentage" },
                            Math.round(this.targetPercentage * 100))))));
    }
}
ReactDOM.render( /*#__PURE__*/
    React.createElement("div", null, /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#FFAAAA", color2: "#550000", value: "250", maxValue: "250", rotation: "270" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#661141", color2: "#D49A6A", value: "250", maxValue: "400", rotation: "160" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#369", color2: "lightgreen", value: "250", maxValue: "295", rotation: "160" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#0E5243", color2: "#857DB1", value: "250", maxValue: "356.8", rotation: "160" })),
    document.getElementById("root"));
<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 -->

<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>
.progress-bar-wrapper {
  margin: 10px 0;
}
.progress-bar-wrapper .progress-bar {
  min-height: 40px;
  width: 100%;
}
.progress-bar-wrapper .progress-bar .progress-bar-progress {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
  min-width: 0;
  width: 100%;
  transition: all 1s ease;
}
.progress-bar-wrapper .progress-bar .percentage {
  font-weight: bold;
  padding-right: 10px;
  text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}
.progress-bar-wrapper .progress-bar .percentage::after {
  content: "%";
}
</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>
class ProgressBar extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            maxWidth: 0
        };
        this.targetPercentage = this.props.value / this.props.maxValue;
    }
    progressBarStyle() {
        return {
            backgroundImage:
                "linear-gradient(" +
                this.props.rotation +
                "deg, " +
                this.props.color +
                ", " +
                this.props.color2 +
                ")",
            maxWidth: this.state.maxWidth,
            backgroundColor: this.props.color,
            borderRadius: this.getRadius()
        };
    }
    componentDidMount() {
        setTimeout(
            () => this.setState({ maxWidth: this.targetPercentage * 100 + "%" }),
            10);
    }
    getRadius() {
        return (
            "5px " + (this.targetPercentage * 100 >= 100 ? "5px 5px" : "0 0") + " 5px");
    }
    render() {
        return /*#__PURE__*/(
            React.createElement("div", { className: "progress-bar-wrapper" }, /*#__PURE__*/
                React.createElement("div", { className: "progress-bar" }, /*#__PURE__*/
                    React.createElement("div", {
                        className: "progress-bar-progress",
                        style: this.progressBarStyle()
                    }, /*#__PURE__*/
                        React.createElement("div", { className: "percentage" },
                            Math.round(this.targetPercentage * 100))))));
    }
}
ReactDOM.render( /*#__PURE__*/
    React.createElement("div", null, /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#FFAAAA", color2: "#550000", value: "250", maxValue: "250", rotation: "270" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#661141", color2: "#D49A6A", value: "250", maxValue: "400", rotation: "160" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#369", color2: "lightgreen", value: "250", maxValue: "295", rotation: "160" }), /*#__PURE__*/
        React.createElement(ProgressBar, { color: "#0E5243", color2: "#857DB1", value: "250", maxValue: "356.8", rotation: "160" })),
    document.getElementById("root"));
</script>

</body>
</html>
Preview