content logo

React Progress Bars:

Multi-Colored React Stacked Bar with Tooltip

Do you produce material and want to share its information with others? If your answer is yes, look at this post and use it on your website. You can even use it on your company website. This is the Multi-Colored React Stacked Bar with Tooltip with a fantastic design. There is a difference between this Responsive React Stacked Bar and others. In this progress bar, all progress cards are gathered and made a huge bar to show all progressions and improvements. So, this HTML Stacked Bar with Effect is more attractive and functional.

By looking at this preview, you can see the colorful page of this code. Therefore, it is better to use this Colorful Stacked Bar on your white website to make it more attractive. The background of this code is light blue and its title is dark blue with a large font. There is a thick line under the title with two colors each one showing a specific percentage. If you put the cursor of the mouse on these colors, their specific percentage will be displayed. This percentage of the Linear Stacked Bar and Tooltip will be shown in a white field and a small colored square.

 

#

Responsive React Stacked Bar

#

Colorful Stacked Bar

#

HTML Stacked Bar with Effect

#

Linear Stacked Bar and Tooltip

<!-- This script got from frontendfreecode.com -->
<div id="app"></div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
html, body, #app {
	height: 80%;
}
.container {
	min-height: 80%;
	background: #b3cce6;
	padding: 30px;
}
.container h1 {
	color: #19334d;
	text-align: center;
}
.progress-bar {
	width: 100%;
	height: 30px;
	background: white;
	border: 2px solid #e6e6e6;
}
.progress {
	height: 100%;
	display: inline-block;
	position: relative;
	transition: width 0.5s;
}
.progress:hover {
	box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.2);
}
.popover {
	position: absolute;
	box-shadow: 0 2px 4px 0 rgba(197, 197, 197, 0.5);
	display: inline-block;
	border: solid 1px #b3b3b3;
	background: #e6e6e6;
	padding: 10px;
	border-radius: 5px;
	top: 45px;
	left: calc(50% - 28px);
}
.popover::before {
	position: absolute;
	display: block;
	box-sizing: border-box;
	content: "";
	border-color: transparent;
	border-style: solid;
	border-width: 11px;
	border-top-width: 0;
	border-bottom-color: #b3b3b3;
	top: -11px;
	left: 11px;
}
.popover::after {
	position: absolute;
	display: block;
	box-sizing: border-box;
	content: "";
	border-color: transparent;
	border-style: solid;
	border-width: 10px;
	border-top-width: 0;
	border-bottom-color: #e6e6e6;
	top: -10px;
	left: 12px;
}
.popover .color {
	width: 15px;
	height: 15px;
	display: inline-block;
	vertical-align: middle;
	margin-right: 5px;
	border-radius: 3px;
}
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } const colors = ['linear-gradient(#00b3b3 60%, #008080)', 'linear-gradient(#ffcc00 60%, #e69900)', 'linear-gradient(#0099ff 60%, #0066cc)'];
const pureColors = ['#00b3b3', '#ffcc00', '#0099ff'];
class Popover extends React.Component {
    render() {
        const { text, index } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", { className: "popover" }, /*#__PURE__*/React.createElement("span", { className: "color", style: { background: pureColors[index] } }), text));
    }
}
class Progress extends React.Component {
    constructor(props) {
        super(props); _defineProperty(this, "handleHover",
            (show = false) => () => {
                this.setState({ show });
            }); this.state = { show: false, width: 0 };
    }
    componentDidMount() {
        setTimeout(() => {
            this.setState({
                width: `${this.props.value}%`
            });
        }, 300);
    }
    render() {
        const { value, index } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", {
                className: "progress",
                style: { width: this.state.width, background: colors[index] },
                onMouseEnter: this.handleHover(true),
                onMouseLeave: this.handleHover()
            },
                this.state.show && /*#__PURE__*/React.createElement(Popover, { text: `${value}%`, index: index })));
    }
}
class ProgressBar extends React.Component {
    render() {
        const { data } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", { className: "progress-bar" },
                data.map((item, index) => /*#__PURE__*/
                    React.createElement(Progress, { key: index, value: item.value, index: index }))));
    }
}
class Application extends React.Component {
    render() {
        const data = [{ value: 45 }, { value: 20 }, { value: 25 }];
        return /*#__PURE__*/(
            React.createElement("div", { className: "container" }, /*#__PURE__*/
                React.createElement("h1", null, "Progress Bar"), /*#__PURE__*/
                React.createElement(ProgressBar, { data: data })));
    }
}
React.render( /*#__PURE__*/React.createElement(Application, null), document.getElementById('app'));
<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/0.13.0/react.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/0.13.0/react.min.js'></script>
<style>
html, body, #app {
	height: 80%;
}
.container {
	min-height: 80%;
	background: #b3cce6;
	padding: 30px;
}
.container h1 {
	color: #19334d;
	text-align: center;
}
.progress-bar {
	width: 100%;
	height: 30px;
	background: white;
	border: 2px solid #e6e6e6;
}
.progress {
	height: 100%;
	display: inline-block;
	position: relative;
	transition: width 0.5s;
}
.progress:hover {
	box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.2);
}
.popover {
	position: absolute;
	box-shadow: 0 2px 4px 0 rgba(197, 197, 197, 0.5);
	display: inline-block;
	border: solid 1px #b3b3b3;
	background: #e6e6e6;
	padding: 10px;
	border-radius: 5px;
	top: 45px;
	left: calc(50% - 28px);
}
.popover::before {
	position: absolute;
	display: block;
	box-sizing: border-box;
	content: "";
	border-color: transparent;
	border-style: solid;
	border-width: 11px;
	border-top-width: 0;
	border-bottom-color: #b3b3b3;
	top: -11px;
	left: 11px;
}
.popover::after {
	position: absolute;
	display: block;
	box-sizing: border-box;
	content: "";
	border-color: transparent;
	border-style: solid;
	border-width: 10px;
	border-top-width: 0;
	border-bottom-color: #e6e6e6;
	top: -10px;
	left: 12px;
}
.popover .color {
	width: 15px;
	height: 15px;
	display: inline-block;
	vertical-align: middle;
	margin-right: 5px;
	border-radius: 3px;
}
</style>

</head>
<body>
<div id="app"></div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } const colors = ['linear-gradient(#00b3b3 60%, #008080)', 'linear-gradient(#ffcc00 60%, #e69900)', 'linear-gradient(#0099ff 60%, #0066cc)'];
const pureColors = ['#00b3b3', '#ffcc00', '#0099ff'];
class Popover extends React.Component {
    render() {
        const { text, index } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", { className: "popover" }, /*#__PURE__*/React.createElement("span", { className: "color", style: { background: pureColors[index] } }), text));
    }
}
class Progress extends React.Component {
    constructor(props) {
        super(props); _defineProperty(this, "handleHover",
            (show = false) => () => {
                this.setState({ show });
            }); this.state = { show: false, width: 0 };
    }
    componentDidMount() {
        setTimeout(() => {
            this.setState({
                width: `${this.props.value}%`
            });
        }, 300);
    }
    render() {
        const { value, index } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", {
                className: "progress",
                style: { width: this.state.width, background: colors[index] },
                onMouseEnter: this.handleHover(true),
                onMouseLeave: this.handleHover()
            },
                this.state.show && /*#__PURE__*/React.createElement(Popover, { text: `${value}%`, index: index })));
    }
}
class ProgressBar extends React.Component {
    render() {
        const { data } = this.props;
        return /*#__PURE__*/(
            React.createElement("div", { className: "progress-bar" },
                data.map((item, index) => /*#__PURE__*/
                    React.createElement(Progress, { key: index, value: item.value, index: index }))));
    }
}
class Application extends React.Component {
    render() {
        const data = [{ value: 45 }, { value: 20 }, { value: 25 }];
        return /*#__PURE__*/(
            React.createElement("div", { className: "container" }, /*#__PURE__*/
                React.createElement("h1", null, "Progress Bar"), /*#__PURE__*/
                React.createElement(ProgressBar, { data: data })));
    }
}
React.render( /*#__PURE__*/React.createElement(Application, null), document.getElementById('app'));
</script>

</body>
</html>
Preview