React MUI Bottom Navigation
Last Updated :
28 Apr, 2025
React Material UI is an open-source library for the React User Interface components that implement Google's Material Design. It provides a wide range collection of prebuilt, reusable, responsive components which requires less coding and are ready to use for production implementation. It includes beautifully designed components that can be easily customized according to the user's needs and requirements.
Bottom Navigation is a way to showcase primary and frequently visited pages or destinations in an application. The developer can display three to five frequently visited pages or destinations at the bottom of the screen using the Bottom Navigation component provided by Material UI. Each navigation can be represented using an icon and an optional text. When the user will click on any bottom screen navigation, the user is taken to the associated destination page to that icon.
Syntax:
<BottomNavigation>
<BottomNavigationAction label="" icon={ } />
</BottomNavigation>
Important props:
- children: It is used to provide the content to the component.
- classes: It is used to override the styles of the component.
- component: It is used to set the root node. It can be a string HTML or a component.
- onChange: It is used to handle the event when the user clicks on any of the bottom navigation options.
- showLables: It is used to allow BottomNavigationAction components to show text labels for the navigation options.
- value: It is used to hold the currently selected Bottom Navigation option.
Setting up React.js application:
Step 1: Create a React.js application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e foldername, move into that directory using the following command:
cd foldername
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install @mui/material @emotion/react @emotion/styled
npm install @mui/icons-material
Project Structure: The project structure will look like this:
Example 1: In this example, we are using the BottomNavigation component. We have imported the icons from Material UI to represent the text and icon both as a Navigation option. "onChange" function on the BottomNavigation prop is responsible to handle the change event, and for the navigation option or destination page, we have used "BottomNavigationAction" with "label" and "icon" props.
- App.js: Write down the below code in the App.js file, where App is our default component provided by React in which code is being written.
JavaScript
import React, { useState, useEffect } from "react";
import BottomNavigation from
"@mui/material/BottomNavigation";
import BottomNavigationAction from
"@mui/material/BottomNavigationAction";
import AttachEmailOutlinedIcon from
'@mui/icons-material/AttachEmailOutlined';
import CloudDownloadOutlinedIcon from
'@mui/icons-material/CloudDownloadOutlined';
import BookmarksOutlinedIcon from
'@mui/icons-material/BookmarksOutlined';
import DeleteOutlineOutlinedIcon from '
@mui/icons-material/DeleteOutlineOutlined';
const App = () => {
const [value, setValue] = React.useState(0);
return (
<div style={{ textAlign: "center", marginTop: "50px" }}>
<h1>Geeks for Geeks</h1>
<h3>Bottom Navigation Component</h3>
<BottomNavigation
showLabels
value={value}
onChange={(event, newValue) => {
setValue(newValue);
}}
>
<BottomNavigationAction label="Email"
icon={<AttachEmailOutlinedIcon />} />
<BottomNavigationAction label="Download"
icon={<CloudDownloadOutlinedIcon />} />
<BottomNavigationAction label="Bookmarked"
icon={<BookmarksOutlinedIcon />} />
<BottomNavigationAction label="Deleted"
icon={<DeleteOutlineOutlinedIcon />} />
</BottomNavigation>
</div>
);
};
export default App;
Step to run the program: To run the application execute the below command from the root directory of the project:
npm start
Output: Your web application will be live on “http://localhost:3000”.Now, you will see the following output:
Example 2: In this example, We have implemented the same functionality using the CustomBottomNavigation component. In this example, we are passing the "BottomNavigationAction" components as a child element to our Custom Navigation component.
- App.js: Write down the below code in the App.js file, where App is our default component provided by React in which code is being written.
JavaScript
import React, { useState, useEffect } from "react";
import BottomNavigation from "@mui/material/BottomNavigation";
import BottomNavigationAction from
"@mui/material/BottomNavigationAction";
import TwitterIcon from '@mui/icons-material/Twitter';
import InstagramIcon from '@mui/icons-material/Instagram';
import FacebookIcon from '@mui/icons-material/Facebook';
import TimelineIcon from '@mui/icons-material/Timeline';
const App = () => {
const [value, setValue] = React.useState(0);
const CustomBottomNavigation = (props) => {
return (<BottomNavigation
showLabels
value={value}
onChange={(event, newValue) => {
setValue(newValue);
}}
>
{props.children}
</BottomNavigation>
);
}
return (
<div style={{ textAlign: "center", marginTop: "50px" }}>
<h1>Geeks for Geeks</h1>
<h3>Bottom Navigation Component</h3>
<CustomBottomNavigation >
<BottomNavigationAction label="Twitter"
icon={<TwitterIcon />} />
<BottomNavigationAction label="Instagram"
icon={<InstagramIcon />} />
<BottomNavigationAction label="Facebook"
icon={<FacebookIcon />} />
<BottomNavigationAction label="Timeline"
icon={<TimelineIcon />} />
</CustomBottomNavigation>
</div>
);
};
export default App;
Step to run the program: To run the application execute the below command from the root directory of the project:
npm start
Output: Your web application will be live on “http://localhost:3000”.Now, you will see the following output:
Reference: https://mui.com/material-ui/react-bottom-navigation/
Similar Reads
React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version
7 min read
React Fundamentals
React IntroductionReactJS is a component-based JavaScript library used to build dynamic and interactive user interfaces. It simplifies the creation of single-page applications (SPAs) with a focus on performance and maintainability. "Hello, World!" Program in ReactJavaScriptimport React from 'react'; function App() {
6 min read
React Environment SetupTo run any React application, we need to first setup a ReactJS Development Environment. In this article, we will show you a step-by-step guide to installing and configuring a working React development environment.Pre-requisite:We must have Nodejs installed on our PC. So, the very first step will be
3 min read
React JS ReactDOMReactDOM is a core React package that provides DOM-specific methods to interact with and manipulate the Document Object Model (DOM), enabling efficient rendering and management of web page elements. ReactDOM is used for: Rendering Components: Displays React components in the DOM.DOM Manipulation: Al
2 min read
React JSXJSX stands for JavaScript XML, and it is a special syntax used in React to simplify building user interfaces. JSX allows you to write HTML-like code directly inside JavaScript, enabling you to create UI components more efficiently. Although JSX looks like regular HTML, itâs actually a syntax extensi
5 min read
ReactJS Rendering ElementsIn this article we will learn about rendering elements in ReactJS, updating the rendered elements and will also discuss about how efficiently the elements are rendered.What are React Elements?React elements are the smallest building blocks of a React application. They are different from DOM elements
3 min read
React ListsIn lists, React makes it easier to render multiple elements dynamically from arrays or objects, ensuring efficient and reusable code. Since nearly 85% of React projects involve displaying data collectionsâlike user profiles, product catalogs, or tasksâunderstanding how to work with lists.To render a
4 min read
React FormsIn React, forms are used to take input from users, like text, numbers, or selections. They work just like HTML forms but are often controlled by React state so you can easily track and update the input values.Example:JavaScriptimport React, { useState } from 'react'; function MyForm() { const [name,
4 min read
ReactJS KeysA key serves as a unique identifier in React, helping to track which items in a list have changed, been updated, or removed. It is particularly useful when dynamically creating components or when users modify the list. When rendering a list, you need to assign a unique key prop to each element in th
4 min read
Components in React
React Lifecycle In React, the lifecycle refers to the various stages a component goes through. These stages allow developers to run specific code at key moments, such as when the component is created, updated, or removed. By understanding the React lifecycle, you can better manage resources, side effects, and perfo
7 min read
React Hooks
Routing in React
Advanced React Concepts
React Projects