CSS: Bootstrap Panel

(Last Updated On: )

In this tutorial I will show you how how to use bootstrap with React/Node to make a panel using just bootstrap.

You will need bootstrap and jquery.

  1. npm install bootstrap@3.3.7 --save
  2. npm install jquery@3.2.1 --save
  3. npm install file-loader --save
  4. npm install url-loader --save

You will also need to update webpack.config.js and add the following under “loaders”.

  1. { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file-loader" },
  2. { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
  3. { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
  4. { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/octet-stream" },
  5. { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=image/svg+xml" }

Next you need to require bootstrap and jQuery.

  1. window.jQuery = window.$ = require("jquery");
  2. require("bootstrap");

You will need to also require the bootstrap css.

  1. require("bootstrap/dist/css/bootstrap.min.css");

The following is all you then need to display a css like panel.

  1. <div className="panel panel-default">
  2. <div className="panel-heading">
  3. <h3 className="panel-title">Panel Title</h3>
  4. </div>
  5. <div className="panel-body">
  6. Panel Text
  7. </div>
  8. </div>