React Navbar Component
Navbar
Limited-time offer for the first 100 customers in 2025. Use code 2025SKY25 at checkout.
Documentation and examples for the React navbar powerful, responsive navigation header component. Includes support for branding, links, dropdowns, and more.
Other Frameworks
CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.
Supported content#
<CNavbar>
come with built-in support for a handful of sub-components. Choose from the following as needed:
<CNavbarBrand>
for your company, product, or project name.<CNavbarNav>
for a full-height and lightweight navigation (including support for dropdowns).<CNavbarToggler>
for use with our collapse plugin and other navigation toggling behaviors.- Flex and spacing utilities for any form controls and actions.
<CNavbarText>
for adding vertically centered strings of text.<CCollapse>
for grouping and hiding navbar contents by a parent breakpoint.
Here's an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the lg
(large) breakpoint.
Basic usage#
Brand#
The <CNavbarBrand>
can be applied to most elements, but an anchor works best, as some elements might require utility classes or custom styles.
Adding images to the <CNavbarBrand>
will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.
Nav#
<CNavbar>
navigation is based on <CNavbarNav>
. Navigation in navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents securely aligned.
And because we use classes for our navs, you can avoid the list-based approach entirely if you like.
You can also use dropdowns in your navbar. Please note that <CDropdown>
component requires variant="nav-item"
.
Forms#
Place various form controls and components within a navbar:
Immediate child elements of <CNavbar>
use flex layout and will default to justify-content: space-between
. Use additional flex utilities as needed to adjust this behavior.
Input groups work, too. If your navbar is an entire form, or mostly a form, you can use the <CForm>
element as the container and save some HTML.
Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.
Text#
Navbars may contain bits of text with the help of <CNavbarText>
. This class adjusts vertical alignment and horizontal spacing for strings of text.
Color schemes#
Theming the navbar has never been easier thanks to the combination of theming classes and background-color
utilities. Set colorScheme="light"
for use with light background colors, or colorScheme="dark"
for dark background colors. Then, customize with .bg-*
utilities.
Containers#
Although it's not required, you can wrap a <CNavbar>
in a <CContainer>
to center it on a page–though note that an inner container is still required. Or you can add a container inside the <CNavbar>
to only center the contents of a fixed or static top navbar.
Use any of the responsive containers to change how wide the content in your navbar is presented.
Placement#
Use our placement
properly to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use position: fixed
, meaning they're pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top
on the <body>
) to prevent overlap with other elements.
Also note that .sticky-top
uses position: sticky
, which isn't fully supported in every browser.
Responsive behaviors#
Navbars can use <CNavbarToggler>
, <CCollapse>
, and expand="{sm|md|lg|xl|xxl}"
property to determine when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.
For navbars that never collapse, add the expand
boolean property on the <CNavbar>
. For navbars that always collapse, don't add any property.
Toggler#
Navbar togglers are left-aligned by default, but should they follow a sibling element like a <CNavbarBrand>
, they'll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.
With no <CNavbarBrand>
shown at the smallest breakpoint:
With a brand name shown on the left and toggler on the right:
With a toggler on the left and brand name on the right:
External content#
Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the <CNavbar>
.
Offcanvas#
Transform your expanding and collapsing navbar into an offcanvas drawer with the offcanvas plugin. We extend both the offcanvas default styles and use our expand="*"
prop to create a dynamic and flexible navigation sidebar.
In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the expand="*"
prop entirely.
To create an offcanvas navbar that expands into a normal navbar at a specific breakpoint like xxl
, use expand="xxl"
property.
API#
Check out the documentation below for a comprehensive guide to all the props you can use with the components mentioned here.