React js UI example. colored modals

React js UI example and template, colored modals! . Take a look at this UI example and see how it can enhance your project. Your can copy or download the code and use it in your project. Don't forget to browse our library of other free React Native templates for even more design and functionality inspiration. Happy coding!
Tags: modal,alert

1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:

npx create-react-app my-awesome-project

cd my-awesome-project

npm start

2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:

npm install [email protected] --save

npm start //For start project again

3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:

import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';


function App() {
  
	return (
		<div>
			<div class="container bootstrap snippets bootdey">
    <div class="btn-demo" id="btn-color-targets">
        <a href="#modalColor" data-target-color="blue" data-toggle="modal" class="btn btn-default ">Blue</a>
        <a href="#modalColor" data-target-color="lightblue" data-toggle="modal" class="btn btn-default ">Light Blue</a>
        <a href="#modalColor" data-target-color="cyan" data-toggle="modal" class="btn btn-default ">Cyan</a>
        <a href="#modalColor" data-target-color="green" data-toggle="modal" class="btn btn-default ">Green</a>
        <a href="#modalColor" data-target-color="lightgreen" data-toggle="modal" class="btn btn-default ">Light Green</a>
        <a href="#modalColor" data-target-color="red" data-toggle="modal" class="btn btn-default ">Red</a>
        <a href="#modalColor" data-target-color="amber" data-toggle="modal" class="btn btn-default ">Amber</a>
        <a href="#modalColor" data-target-color="orange" data-toggle="modal" class="btn btn-default ">Orange</a>
        <a href="#modalColor" data-target-color="teal" data-toggle="modal" class="btn btn-default ">Teal</a>
        <a href="#modalColor" data-target-color="bluegray" data-toggle="modal" class="btn btn-default ">Blue Gray</a>
    </div>
</div>

<div class="modal fade" data-modal-color="" id="modalColor" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Modal title</h4>
            </div>
            <div class="modal-body">
                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sodales orci ante, sed ornare eros vestibulum ut. Ut accumsan vitae eros sit amet tristique. Nullam scelerisque nunc enim, non dignissim nibh faucibus ullamcorper. Fusce pulvinar libero vel ligula iaculis ullamcorper. Integer dapibus, mi ac tempor varius, purus nibh mattis erat, vitae porta nunc nisi non tellus. Vivamus mollis ante non massa egestas fringilla. Vestibulum egestas consectetur nunc at ultricies. Morbi quis consectetur nunc.</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-link">Save changes</button>
                <button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

		</div>
	);
}
export default App;

4. Now we need to add below code into our my-awesome-project/src/App.css file :

body{margin-top:20px;}

.modal[data-modal-color] {
  color: #fff;
}

.modal .modal-header {
  padding: 23px 26px;
  border-bottom: 1px solid transparent;
}

.modal .modal-content {
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.31);
  border-radius: 3px;
  border: 0;
}

.modal-footer {
  padding: 15px;
  text-align: right;
  border-top: 1px solid transparent;
}

.modal[data-modal-color] .modal-footer {
  background: rgba(0, 0, 0, 0.1);
}

.modal[data-modal-color] .modal-footer .btn-link {
  font-weight: 400;
}

.modal[data-modal-color] .modal-title, .modal[data-modal-color] .modal-footer .btn-link {
  color: #fff;
}

.modal .modal-footer .btn-link {
  font-size: 14px;
  color: #000;
  font-weight: 500;
}

.btn-link {
  color: #797979;
  text-decoration: none;
  border-radius: 2px;
}

.modal[data-modal-color] .modal-footer .btn-link:hover {
  background-color: rgba(0, 0, 0, 0.1);
  text-decoration:none;
}

.modal[data-modal-color] .modal-footer .btn-link {
  font-weight: 400;
}

/* ========== MODAL COLORS ===============================*/
.modal[data-modal-color="blue"] .modal-content {
  background: #2196f3;
}

.modal[data-modal-color="lightblue"] .modal-content {
  background: #03a9f4;
}

.modal[data-modal-color="cyan"] .modal-content {
  background: #00bcd4;
}

.modal[data-modal-color="green"] .modal-content {
  background: #4caf50;
}

.modal[data-modal-color="lightgreen"] .modal-content {
  background: #8bc34a;
}

.modal[data-modal-color="red"] .modal-content {
  background: #f44336;
}

.modal[data-modal-color="amber"] .modal-content {
  background: #ffc107;
}

.modal[data-modal-color="orange"] .modal-content {
  background: #ff9800;
}

.modal[data-modal-color="teal"] .modal-content {
  background: #009688;
}

.modal[data-modal-color="bluegray"] .modal-content {
  background: #607d8b;
}

Similar snippets

React js template and ui example login box modal

login box modal

React js template and ui example Bootstrap Gallery with Modal Lightbox and Carousel

Bootstrap Gallery with Modal Lightbox and Carousel

React js template and ui example Contact Form

Contact Form

React js template and ui example alerts with arrow

alerts with arrow

React js template and ui example bs5 dark footer

bs5 dark footer

React js template and ui example chat app

chat app

React js template and ui example user profile bio graph and total sales

user profile bio graph and total sales

React js template and ui example General Search Results

General Search Results