Skip to main content

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 container
  • Navbar.Start - Left-aligned section for logos and primary navigation
  • Navbar.End - Right-aligned section for actions and user controls

Props

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.
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.
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

With search and actions

With dropdown menu

With accessible sections

Mobile responsive navbar

With custom spacing

Accessibility

  • Uses semantic <nav> element with role="navigation" attribute
  • Automatically includes proper navigation landmarks for screen readers
  • Supports aria-label on start and end sections for better context
  • Keyboard navigation works naturally with focusable elements
  • Sticky navbar maintains focus management during scroll

Styling customization

Customize the navbar appearance using className props:
The component uses CSS modules internally and exposes data attributes for styling: