Friday, October 10, 2025
HomeLanguagesHow to use Breadcrumbs Component in Material UI ?

How to use Breadcrumbs Component in Material UI ?

Breadcrumbs allow users to make selections from a range of values. Material UI for React has this component available for us, and it is very easy to integrate. We can use Breadcrumbs Component in ReactJS using the following approach.

Creating React Application And Installing Module:

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

npx create-react-app foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command.

cd foldername

Step 3: After creating the ReactJS application, Install the material-ui modules using the following command.

npm install @mui/material

Project Structure: It will look like the following.

Project Structure

Example 1: In this example, we will create a simple breadcrumb application of different links. Please update App.js like below.

Filename: App.js

Javascript




import { Breadcrumbs, Link, Typography } from "@mui/material";
import React from "react";
 
const App = () => {
    return (
        <div
            style={{
                margin: "auto",
                display: "table",
            }}
        >
            <h4>How to use Breadcrumbs in ReactJS?</h4>
            <Breadcrumbs aria-label="breadcrumb">
                <Link
                    color="inherit"
                    href="/"
                    onClick={(event) => {
                        event.preventDefault();
                        alert("Home Page Clicked");
                    }}
                >
                    Home Page
                </Link>
                <Link
                    color="inherit"
                    href="/getting-started/installation/"
                    onClick={(event) => {
                        event.preventDefault();
                        alert("Dashboard Clicked");
                    }}
                >
                    Dashboard
                </Link>
                <Typography color="textPrimary">
                    Breadcrumb
                </Typography>
            </Breadcrumbs>
        </div>
    );
};
 
export default App;


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.

Example 2: In this example, we will create a collapsed breadcrumb application of different links with the help of maxItems props of the Breadcrumbs component. Please update App.js like the below.

Filename: App.js

Javascript




import { Breadcrumbs, Link, Typography } from "@mui/material";
import React from "react";
 
const App = () => {
    return (
        <div
            style={{
                margin: "auto",
                display: "table",
            }}
        >
            <h4>How to use Breadcrumbs in ReactJS?</h4>
            <Breadcrumbs aria-label="breadcrumb" maxItems={2}>
                <Link
                    color="inherit"
                >
                    Home Page
                </Link>
                <Link
                    color="inherit"
                >
                    Dashboard
                </Link>
                <Link
                    color="inherit"
                >
                    About
                </Link>
                <Link
                    color="inherit"
                >
                    Careers
                </Link>
                <Link
                    color="inherit"
                >
                    Contact
                </Link>
                <Typography color="textPrimary">
                    Breadcrumb
                </Typography>
            </Breadcrumbs>
        </div>
    );
};
 
export default App;


Steps to run the application:

npm start

Output:

Reference: https://mui.com/material-ui/react-breadcrumbs/#main-content

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS