Skip to main content

Navbar

Navbars or navigation bars are used to provide actions to users within a website. They are typically used at the top of a page to help users navigate between different sections of the website. Navbars can also include search bars, logos, and other branding elements.

Design Hints
Navbars are a great way to provide users with quick access to important information and actions on a website. They are also a tool which can be used for branding as they tend to be consistent across the website.
Accessiblity Hints
For accessibility, it is important to ensure that the blocks inside the navbar like links, buttons, search input etc., are accessible. This can be achieved by using appropriate color contrast, clear and concise language, and hiding the aria for logos if other branding elements like name are present or providing alternate text. Links and Buttons should also have descriptive text to provide context and help users.

This is a simple navbar. In smaller form factors (less than md) the links in the middle will go into the next line. There is no javascript required for this to work. In the preview below, the second navbar is just to visualize the responsive behavior.

Design Hints
While this maybe suitable for certain websites, it is important to consider that if the links go on to another line in smaller devices, you may lose a lot of space for the rest of the content on the page. Consider using a navbar with a hamburger menu for actions and links on smaller screens.

Responsive Navbar With Hamburger Menu

Warning :

Experimental Release. Not recommended for use before proper testing

Note : Requires Javascript to work.

The responsive navbar which retains the logo, brand and a navigation menu (hamburger) on smaller screens, which can be used to toggle the menu on and off. In the preview below, the second navbar is just to visualize the responsive behavior.

Accessibility Testing Status

ComponentNVDAWindows NarratorWAVEAxeIBM Equal Access
Responsive Navbar With Logo and LinksYesYesYesYesYes
Responsive Navbar With Hamburger MenuYesYesYesYesYes

Since we use the <nav> element, it is accessible out of the box. The hamburger menu component is implemented with the WAI-ARIA 1.2 design pattern. The components above implement all the required functionality mention in WAI-ARIA APG specification for menu button and WAI-ARIA APG specification for menu .

The menu supports the following keyboard navigation once opened:

Keyboard NavigationDescription
Arrow Up/DownMoves the focus to the previous/next menu item.
EscapeCloses the dropdown menu.
EnterTriggers the action associated with the focused menu item.
Arrow Left/RightMoves the focus to the first/last menu item.
Tab or Shift + TabMoves the focus out of the menu and into the menu button.