Home Bootstrap 4 Reactjs Responsive Sidebar Template Free

Reactjs Responsive Sidebar Template Free

by therichpost
Published: Updated: 9 comments
Reactjs Responsive Sidebar Template Free

Hello friends, welcome back to my blog. Today in this blog post, I am going to show you, Reactjs Responsive Sidebar Template Free.

Reactjs Responsive Template

For reactjs new comers, please check the below link:

Reactjs Basic Tutorials


Friends now I proceed onwards and here is the working code snippet for Reactjs Responsive Sidebar Template Free and please use this carefully to avoid the mistakes:

1. Firstly, 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 reacttepmate

cd reacttepmate

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 bootstrap --save

npm install jquery --save

npm install popper.js --save

npm start //For start project again

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

import React from 'react';

import './App.css';

//Importing bootstrap and other modules
import 'bootstrap/dist/css/bootstrap.min.css';
import 'bootstrap/dist/js/bootstrap.min.js';
import 'jquery/dist/jquery.min.js';
import 'popper.js/dist/umd/popper.min.js'

import $ from 'jquery';
class App extends React.Component {
  componentDidMount(){

    // Sidebar Toggle Menu Click
    $("#menu-toggle").click(function(e) {
      e.preventDefault();
      $("#wrapper").toggleClass("toggled");
     });
  }
  render() {
    return (
      <div className="MainDiv">
        <div class="d-flex" id="wrapper">


            <div class="bg-light border-right" id="sidebar-wrapper">
              <div class="sidebar-heading">Therichpost </div>
              <div class="list-group list-group-flush">
                <a href="#" class="list-group-item list-group-item-action bg-light">Dashboard</a>
                <a href="#" class="list-group-item list-group-item-action bg-light">Shortcuts</a>
                <a href="#" class="list-group-item list-group-item-action bg-light">Overview</a>
                <a href="#" class="list-group-item list-group-item-action bg-light">Events</a>
                <a href="#" class="list-group-item list-group-item-action bg-light">Profile</a>
                <a href="#" class="list-group-item list-group-item-action bg-light">Status</a>
              </div>
            </div>

            <div id="page-content-wrapper">

              <nav class="navbar navbar-expand-lg navbar-light bg-light border-bottom">
                <button class="btn btn-primary" id="menu-toggle">Toggle Menu</button>

                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                  <span class="navbar-toggler-icon"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                  <ul class="navbar-nav ml-auto mt-2 mt-lg-0">
                    <li class="nav-item active">
                      <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                    </li>
                    <li class="nav-item">
                      <a class="nav-link" href="#">Link</a>
                    </li>
                    <li class="nav-item dropdown">
                      <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Dropdown
                      </a>
                      <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="#">Something else here</a>
                      </div>
                    </li>
                  </ul>
                </div>
              </nav>

              <div class="container-fluid">
                <h1 class="mt-4">Reactjs Sidebar Responsive Template - Therichpost.com</h1>
                <p>Reactjs Sidebar Responsive Template - Therichpost.com 
                    Reactjs Sidebar Responsive Template - Therichpost.com
                    Reactjs Sidebar Responsive Template - Therichpost.com
                    Reactjs Sidebar Responsive Template - Therichpost.com
                    Reactjs Sidebar Responsive Template - Therichpost.com
                    Reactjs Sidebar Responsive Template - Therichpost.com
                    Reactjs Sidebar Responsive Template - Therichpost.com
                </p>
                
              </div>
            </div>


        </div>

      </div>
    );
  }
}

export default App;

4. Now friends, we need to below code into our projectname/src/App.css file for some custom styling:

body {
  overflow-x: hidden;
  }

  #sidebar-wrapper {
  min-height: 100vh;
  margin-left: -15rem;
  -webkit-transition: margin .25s ease-out;
  -moz-transition: margin .25s ease-out;
  -o-transition: margin .25s ease-out;
  transition: margin .25s ease-out;
  }

  #sidebar-wrapper .sidebar-heading {
  padding: 0.875rem 1.25rem;
  font-size: 1.2rem;
  }

  #sidebar-wrapper .list-group {
  width: 15rem;
  }

  #page-content-wrapper {
  min-width: 100vw;
  }

  #wrapper.toggled #sidebar-wrapper {
  margin-left: 0;
  }

  @media (min-width: 768px) {
  #sidebar-wrapper {
      margin-left: 0;
  }

  #page-content-wrapper {
      min-width: 0;
      width: 100%;
  }

  #wrapper.toggled #sidebar-wrapper {
      margin-left: -15rem;
  }
  }
  #wrapper{background-color: lightblue;}

Now we are done friends. If you have any kind of query or suggestion or any requirement then feel free to comment below.

Note: Friends, I just tell the basic setup and things, you can change the code according to your requirements. For better understanding must watch video above.

I will appreciate that if you will tell your views for this post. Nothing matters if your views will be good or bad.

Jassa

Thanks

You may also like

9 comments

Jah December 17, 2020 - 4:21 pm

thanks you so much! you saved my life! 😀

Reply
Jah Serenio December 17, 2020 - 4:22 pm

thanks you so much! you saved my life! 😀

Reply
Ajay Malhotra December 17, 2020 - 4:24 pm

Great and thanks 🙂

Reply
Ade January 21, 2021 - 8:39 pm

This post has saved me days of searching. Thanks a whole lot. I can customize with this.

Reply
Ajay Malhotra January 22, 2021 - 4:27 am

Wow that’s great 🙂

Reply
Amaneh Eskandari June 25, 2021 - 11:08 am

thank you !

Reply
Ajay Malhotra June 25, 2021 - 1:15 pm

Welcome.

Reply
Yamraaj July 19, 2022 - 10:58 am

Bhot bdhiya re baba

Reply
therichpost July 19, 2022 - 5:01 pm

Thanks

Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.