A horizontal navigation bar for primary site links, branding, and interactive elements.
Basic
A navbar provides a variety of actions or options for users to select.
Installation
If you hit any issues, make sure you check out the installation guide here for more information.
Composed components
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
The Navbar comes packed with several components to enhance functionality and provide a seamless experience.
Manual installation
Make sure you also install the composed components and the required packages for the component to function properly.
Anatomy
Intent
There are three types of intents: navbar
, floating
, and inset
, each with distinct behaviors.
Default
The default intent for the Navbar
is "default"
. You can customize the appearance by setting the intent
prop to "float"
or "inset"
.
Float
The "float"
intent places a border inside the navbar and adds padding around the container. It’s useful when you want the navbar to appear visually distinct from the page layout. Live example can be found here at Navbar 02.
Inset
The "inset"
intent adds horizontal padding to align the navbar with your main content. You can see it in action in the demo, or view a live example here.
Logo
The logo is typically the first item in the navbar, usually representing the brand or company.
Current
Highlight the active page by setting isCurrent
to true
on the relevant NavbarItem
.
Sticky
Make the navbar stick to the top of the page by enabling the isSticky
prop.
Using Icons
When using icons inside NavbarItem
, include NavbarLabel
to keep everything aligned and accessible.
Dropdown
To use a dropdown inside the navbar, use the Menu
component. If you want a chevron icon on the right, set the correct column start.
If there’s an icon on the left, use col-start-3
.
If there’s no icon, use col-start-2
.
When using an icon on the left, wrap the text in NavbarLabel
and place the chevron using col-start-3
.
Spacer
Use NavbarSpacer
to push items apart. This is especially useful for layouts where you want content (like a logo) on the left and actions (like buttons) on the right.
Gap
Use NavbarGap
to control the spacing between navigation items. This gives you precise control over layout density.
Separator
NavbarSeparator
adds a vertical divider between items. It’s useful for grouping or visually separating actions in the navbar.
Responsive
Use NavbarMobile
to create a responsive navbar experience. It works inside a Sheet
and is perfect for mobile-friendly navigation.
Using the Layout
There are several ways to use the layout, depending on your framework. Or, if you're not using any framework, you can simply apply the layout component.
Common Usage
A typical approach is to wrap your content with the layout like this:
Inertia.js
If you're using Inertia.js, you can implement a persistent layout. Here's how it looks:
When using Inertia.js with Laravel, the layout, components, and pages files are typically located in the resources/js folder. All the examples below assume they are within this directory.
Next.js
If you're using Next.js, there's no extra configuration needed. Simply create a page component and ensure it inherits the layout like this: