content logo

React Buttons:

Colorful React Buttons with Shadow Effect on Hover

The buttons displayed in this post are simple but functional. These buttons have a shadow effect. By placing the mouse cursor on each of the buttons, a shadow is displayed for that button. The color of each button is different. The inactive button is gray. The title of the buttons is also white. These buttons use React.

#

CSS Shadow Effect Code

#

HTML Colorful React Buttons

#

Free React Button Effect

#

React Button Hovering Effect

<!-- This script got from frontendfreecode.com -->
<div id="react-button">
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
body {
  font-family: "Rubik", sans-serif;
}
.button, .btn-warning, .btn-success, .btn-primary {
  background: #3298CE;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  padding: 5px 20px;
  margin: 25px;
  font-size: 16px;
  border-radius: 3px;
  border: 1px solid #27639A;
  font-weight: 600;
  cursor: pointer;
}
.button .fa, .btn-warning .fa, .btn-success .fa, .btn-primary .fa {
  margin-right: 10px;
  margin-left: -5px;
}
.button:disabled, .btn-warning:disabled, .btn-success:disabled, .btn-primary:disabled {
  background: rgba(155, 155, 155, 0.5) !important;
  border-color: rgba(155, 155, 155, 0.5) !important;
  color: rgba(155, 155, 155, 0.9) !important;
}
.button:disabled:hover, .btn-warning:disabled:hover, .btn-success:disabled:hover, .btn-primary:disabled:hover {
  box-shadow: none !important;
}
.button:active, .btn-warning:active, .btn-success:active, .btn-primary:active {
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: #3AACE8;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
.btn-success {
  background-color: #32CE68;
  border: 1px solid #279A4F;
}
.btn-success:hover {
  background-color: #3AD178;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
.btn-warning {
  background-color: #D14836;
  border-color: #9A2727;
}
.btn-warning:hover {
  background: #E35A47;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
class Button extends React.Component {
  render() {
    const { children, className, href, icon, ...others } = this.props;
    const props = { ...others, href, className, ref: 'button', disabled: this.props.disabled };
    const element = href ? 'a' : 'button';
    return React.createElement(
    element, props, icon ? /*#__PURE__*/React.createElement("i", { className: this.props.icon }) : null, children);
  }}
ReactDOM.render( /*#__PURE__*/
React.createElement("div", null, /*#__PURE__*/
React.createElement(Button, { className: "btn-primary" }, "click me"), /*#__PURE__*/
React.createElement(Button, { className: "btn-success", icon: "fa fa-phone" }, "success "), /*#__PURE__*/
React.createElement(Button, { className: "btn-success", disabled: true }, "disabled ")),
document.getElementById('react-button'));
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Rubik'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/classnames/2.2.5/index.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/font-awesome/4.6.3/css/font-awesome.min.css'>
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Rubik'>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/classnames/2.2.5/index.min.js'></script>
<style>
body {
  font-family: "Rubik", sans-serif;
}
.button, .btn-warning, .btn-success, .btn-primary {
  background: #3298CE;
  color: #fff;
  text-decoration: none;
  text-transform: uppercase;
  padding: 5px 20px;
  margin: 25px;
  font-size: 16px;
  border-radius: 3px;
  border: 1px solid #27639A;
  font-weight: 600;
  cursor: pointer;
}
.button .fa, .btn-warning .fa, .btn-success .fa, .btn-primary .fa {
  margin-right: 10px;
  margin-left: -5px;
}
.button:disabled, .btn-warning:disabled, .btn-success:disabled, .btn-primary:disabled {
  background: rgba(155, 155, 155, 0.5) !important;
  border-color: rgba(155, 155, 155, 0.5) !important;
  color: rgba(155, 155, 155, 0.9) !important;
}
.button:disabled:hover, .btn-warning:disabled:hover, .btn-success:disabled:hover, .btn-primary:disabled:hover {
  box-shadow: none !important;
}
.button:active, .btn-warning:active, .btn-success:active, .btn-primary:active {
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: #3AACE8;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
.btn-success {
  background-color: #32CE68;
  border: 1px solid #279A4F;
}
.btn-success:hover {
  background-color: #3AD178;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
.btn-warning {
  background-color: #D14836;
  border-color: #9A2727;
}
.btn-warning:hover {
  background: #E35A47;
  box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.2);
}
</style>

</head>
<body>
<div id="react-button">
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>
<script>
class Button extends React.Component {
  render() {
    const { children, className, href, icon, ...others } = this.props;
    const props = { ...others, href, className, ref: 'button', disabled: this.props.disabled };
    const element = href ? 'a' : 'button';
    return React.createElement(
    element, props, icon ? /*#__PURE__*/React.createElement("i", { className: this.props.icon }) : null, children);
  }}
ReactDOM.render( /*#__PURE__*/
React.createElement("div", null, /*#__PURE__*/
React.createElement(Button, { className: "btn-primary" }, "click me"), /*#__PURE__*/
React.createElement(Button, { className: "btn-success", icon: "fa fa-phone" }, "success "), /*#__PURE__*/
React.createElement(Button, { className: "btn-success", disabled: true }, "disabled ")),
document.getElementById('react-button'));
</script>

</body>
</html>
Preview