Overview
The Navbar component provides a responsive horizontal navigation bar typically placed at the top of an application. It offers flexible layout sections for organizing navigation items, branding, and action buttons.Use cases
- Display site-wide navigation and branding
- Provide access to primary navigation links
- Show user account controls and settings
- Display search inputs and action buttons
- Create consistent navigation across pages
- Build responsive mobile-friendly headers
Anatomy
The Navbar component is composed of:Navbar- Root navigation containerNavbar.Start- Left-aligned section for logos and primary navigationNavbar.End- Right-aligned section for actions and user controls
Props
Navbar (root)
boolean
default:"false"
When true, the navbar will stick to the top of the viewport when scrolling.
string
Additional CSS class names to apply to the navbar container.
Navbar.Start
string
Accessible label for the start section. When provided, the section will have a group role.
string
Additional CSS class names to apply to the start section.
number | string
Spacing between items in the start section. Defaults to 5.
Navbar.End
string
Accessible label for the end section. When provided, the section will have a group role.
string
Additional CSS class names to apply to the end section.
number | string
Spacing between items in the end section. Defaults to 5.
Usage
Basic navbar
Sticky navbar
With search and actions
With dropdown menu
With accessible sections
Mobile responsive navbar
With custom spacing
Accessibility
- Uses semantic
<nav>element withrole="navigation"attribute - Automatically includes proper navigation landmarks for screen readers
- Supports
aria-labelon start and end sections for better context - Keyboard navigation works naturally with focusable elements
- Sticky navbar maintains focus management during scroll