Skip to content
Related Articles

Related Articles

Improve Article

How to Create Breadcrumb Component in React with Plain CSS ?

  • Last Updated : 26 Jul, 2021
Geek Week

In ReactJS, we can create a Breadcrumb Component easily with Plain CSS. Since we have to only make a new component with JSX code for getting a basic HTML code for the Breadcrumb, and then we have to apply CSS effects to make some changes and make its appearance the best.

ReactJS is a component-based web framework that is used to make reusable components in Frontend. Breadcrumbs are used to give an advanced Navbar which we can use in Frontend to make traversing our website interactive.

Approach: To make a breadcrumb, the basic CSS that we will require is shown below.

  • Step 1: Make an inline list of items that are to be included in the breadcrumb of the Navbar. The code for it is given below:

    li {
       padding: 10px 16px;  

    Padding is applied to make some gap between the items in the Navbar and text-decoration is used to make the text appear underlined.

  • Step 2: Styling the breadcrumb by adding some characters to separate the list items such as slash or comma etc. To do that we have to use the (::before) in CSS as given below:

    li,li:before {
       padding: 8px;
       color: black;
  • Step 3: We can also set the background color and the border to make the look of our Breadcrumb nice.

Creating React Application And Installing Module:

  • Step 1: Create a React application using the following command:

    npx create-react-app GFGHosting
  • Step 2: After creating your project folder i.e. GFGHosting, move to it using the following command:

    cd GFGHosting

Project Structure: It will look like the following.

Project Structure

Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.


import React from 'react'
function App() {
  return (
    <div className="App">
          <li> Home </li>
          <li> About </li>
          <li> Services</li>
export default App;


   text-align : center;
   display: inline;
   padding: 10px 16px;  
   li+li:before {
   padding: 8px;
   color: black;
   height : 20px;
   width : 100%;  

Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

The breadcrumb is created

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :