Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NextJS
  • Material UI
  • React Bootstrap
  • React Suite
  • Ant Design
  • Reactstrap
  • BlueprintJS
  • React Desktop
  • React Native
  • React Rebass
  • React Spring
  • React Evergreen
  • ReactJS
  • ReactJS
  • JS Formatter
  • Web Technology
Open In App
Next Article:
How to Align Navbar Items to Center using Bootstrap 4 ?
Next article icon

How to make rounded corner for navbar using react-bootstrap?

Last Updated : 24 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

In single-page applications, Navigation Bars are the most important components of web applications to provide national access to different sections and features of the applications. We can customize the navigation bar by adjusting the colors, width, and we can also make the rounded corners for the navbar using react-bootstrap. So this article will help us to learn to make rounded corners for the navbar using react-bootstrap.

Prerequisites:

  • ReactJs
  • React-Bootstrap

We are making the navbar using the below approaches:

Table of Content

  • Using rounded-pill Class
  • Using Style Prop

Steps to create the project:

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

npx create-react-app rounded-corner

Step 2: After creating your project folder(i.e. rounded-corner), move to it by using the following command:

cd rounded-corner

Step 3: Now install react-bootstrap in your working directory i.e. import-comp by executing the below command in the VScode terminal:

npm install react-bootstrap bootstrap

Step 4: Now we need to Add Bootstrap CSS to the index.js or App.js file:

import 'bootstrap/dist/css/bootstrap.min.css';

Project Structure:

Approach 1: Using rounded-pill Class

In the Approach, we have used the "rounded-pill" class to create rounded corners for the navbar. This class is applied to the Navbar component within the className prop, and it is a part of Bootstrap's utility classes. When applied, it rounds the corners of the navbar, giving it a sleek and modern appearance. The "rounded-pill" class is a great choice for creating a navigation bar with a subtle, pill-shaped edge, making it visually appealing and user-friendly.

Example: Below is an example of the above-discussed approach.

JavaScript
import React from 'react'; import {     Navbar, Nav,     Container, Image } from 'react-bootstrap'; function App() {     const geeksForGeeksLogo = 'https://media.geeksforgeeks.org/wp-content/cdn-uploads/20190710102234/download3.png';     return (         <div>             <center>                 <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>                 <h5>                     Approach 1: Using rounded-pill class                 </h5>             </center>             <Navbar bg="dark" variant="dark"                 className="rounded-pill m-1">                 <Container>                     <Navbar.Brand href="#">                         <Image src={geeksForGeeksLogo} width="30"                             height="30" className="d-inline-block align-top"                             alt="GeeksforGeeks Logo" />                         GeeksforGeeks                     </Navbar.Brand>                     <Nav className="ml-auto">                         <Nav.Link href="#">Articles</Nav.Link>                         <Nav.Link href="#">Courses</Nav.Link>                         <Nav.Link href="#">Tutorials</Nav.Link>                         <Nav.Link href="#">Videos</Nav.Link>                     </Nav>                 </Container>             </Navbar>         </div>     ); } export default App; 

Output:


NavPill-(2)
Output


Approach 2: Using Style Prop

In this approach, we have used the "style" prop, the navbarStyle object is defined to include a border-radius property set to '30px,' which controls the rounding of the navbar's corners. By applying this style object to the Navbar component using the style prop, you can easily customize the visual appearance of the navbar. In this case, a value of '30px' for borderRadius creates rounded corners.

Example: Below is an example of the above-discussed approach.

JavaScript
import React from 'react'; import {     Navbar, Nav,     Container, Image } from 'react-bootstrap'; function App() {     const geeksForGeeksLogo = 'https://media.geeksforgeeks.org/wp-content/uploads/20230816191453/gfglogo.png';     const navbarStyle = {         borderRadius: '30px',         margin: "10px"     };     return (         <div className="text-center">             <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>             <h5>Approach 2: Using Style Prop</h5>             <Navbar bg="dark" variant="dark" style={navbarStyle}>                 <Container>                     <Navbar.Brand href="#">                         <Image src={geeksForGeeksLogo} width="40"                             height="40" className="d-inline-block align-top"                             alt="GeeksforGeeks Logo" />                         GeeksforGeeks                     </Navbar.Brand>                     <Nav className="ml-auto">                         <Nav.Link href="#">Programming</Nav.Link>                         <Nav.Link href="#">Articles</Nav.Link>                         <Nav.Link href="#">Courses</Nav.Link>                         <Nav.Link href="#">Tutorials</Nav.Link>                     </Nav>                 </Container>             </Navbar>         </div>     ); } export default App; 

Output:


NavPill2
Output




Next Article
How to Align Navbar Items to Center using Bootstrap 4 ?

G

gauravgandal
Improve
Article Tags :
  • Web Technologies
  • ReactJS
  • Geeks Premier League
  • React-Bootstrap
  • Geeks Premier League 2023

Similar Reads

  • How to Align Navbar Items to Center using Bootstrap 4 ?
    Aligning navbar items to the center using Bootstrap refers to the practice of positioning navigation links in the middle of the navigation bar for a balanced and aesthetic design. Bootstrap's utility classes make it easy to implement this alignment responsively and efficiently. There are some common
    3 min read
  • How to Create Radar Chart using React Bootstrap ?
    The radar chart is a chart or plot that consists of a sequence of equiangular spokes, called radii, with each spoke representing one of the variables. A radar chart is basically a graphical method of displaying data in the form of a two-dimensional chart of three or more quantitative variables that
    2 min read
  • How to make rounded corner using CSS ?
    Creating rounded corners is a popular design technique in web development that enhances the visual appeal of web elements. The CSS border-radius property allows you to easily set the radius of an element's corners, making them rounded. In this article, we will explore how to use the border-radius pr
    3 min read
  • How to Add Icon in NavBar using React-Bootstrap ?
    This article will show you how to add an icon in the navigation bar using React-Bootstrap. We will use React-Bootstrap because it makes it easy to use reusable components without implementing them. PrerequisitesReactJSJSXReact BootstrapCreating React App and Installing ModuleStep 1: Create a React a
    2 min read
  • How to create a navigation bar using React-Bootstrap?
    React-Bootstrap is a front-end framework that was designed with React in mind. The NavBar Component is a navigation header that is responsive and powerful. It supports navigation, branding, and many other related features. In this article, we are going to implement a navigation bar using React Boots
    2 min read
  • How to create a multi level Dropdown NavBar in React-bootstrap using map?
    In this article, we are going to implement a drop-down-based navigation bar using React-Bootstrap. We will map the navigation links from an array to a navigation bar with suitable React-Bootstrap classes and components. Prerequisite:React JSHTML CSSJavaScriptJSXSteps to create React Application and
    4 min read
  • How to Make the Navbar Collapse on Smaller Screens in React Bootstrap ?
    Earlier, websites were mainly designed for desktop computers because that's what most people used. But now, with so many devices that can access the internet, websites need to be responsive on all sorts of screen sizes and types. So, In this article, we will see how to make Navbar collapse on a smal
    3 min read
  • How to Make an Image Rounded in Bootstrap ?
    In Bootstrap, you can make an image rounded by applying the rounded class to it. This class sets the border-radius property, giving the image rounded corners for a softer and more visually appealing appearance. Below are the approaches to make an image rounded in Bootstrap: Table of Content Using ro
    2 min read
  • How to Make Rounded or Custom Border Radius in React Native ?
    React Native offers a simple solution to achieving this effect through the border­Radius property. In this article, we'll see how we can apply border-radius to the react native components. Border Radius holds a significant role. It acts as a styling attribute that controls the curvature of corners f
    3 min read
  • How to Create Carousel with Multiple Items & Rounded Image in Bootstrap ?
    In Bootstrap, a carousel presents dynamic image slideshows or content showcases. Crafting a carousel with multiple items and rounded images in Bootstrap 5 involves tailoring the carousel layout and styling images with rounded edges for a visually appealing presentation. ApproachCreate an HTML file a
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences