Navigation Patterns — UI/UX

Navigation answers "where am I" and "where else can I go". Wrap it in <nav aria-label="...">: <nav> marks a block of navigation, and aria-label gives it a…

Open a shopping app on your phone. Along the bottom of the screen there's a row of icons, one in colour and the rest grey. Without thinking, you know which page you're on and what to tap to move.

That row of icons is navigation. The job of navigation is to tell a visitor two things: where they are, and how to get somewhere else. It's like the floor map in a shopping mall. The list of floors and their shops is the main navigation. The red "You are here" dot is the current-page marker, for the page that is open now. Sometimes there is also a route from the entrance to the shop you want: that is a breadcrumb. A good map is visible without searching for it, and it has only one red dot.

Navigation patterns

Pattern Suits At Mist Homestay
Links on top (top nav) a site with few main pages Home, Rooms, Location, Bookings
Bottom tab bar (a row of buttons at the bottom of the screen) a phone app with 3 to 5 destinations you switch between often Mrs. Sri's dashboard: Bookings, Calendar, Rooms, Account
Sidebar (a menu column at the side) an app with many sections, on a wide screen Mrs. Sri's dashboard on a laptop
Hamburger (a menu hidden behind one button) links that don't fit and are rarely used Privacy policy, Terms, About Mrs. Sri
Breadcrumb (the path of pages) a page that sits below another page Home › Rooms › Terrace Room

These patterns combine. The guest site uses links on top, and the room page adds a breadcrumb.

Wrap it in nav, mark the current page

This is the guest site's main navigation. Its links are written as a list (<ul>, with one <li> for each link) inside <nav>. The Rooms link is marked as the current page:

<nav aria-label="Main navigation">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/rooms" aria-current="page">Rooms</a></li>
    <li><a href="/location">Location</a></li>
    <li><a href="/bookings">Bookings</a></li>
  </ul>
</nav>

<style>
  nav a { display: block; padding: 12px 10px; color: #475569; text-decoration: none; }
  nav a[aria-current="page"] { color: #15803d; font-weight: 700; box-shadow: inset 0 -3px #15803d; }
</style>

In the exercise, the starter is a <nav> with three links: Home, Products, About. Add aria-label="Main navigation" to the <nav>, and aria-current="page" to the Home link only.

A breadcrumb on the room page

The Terrace Room page sits one level below the Rooms page. A breadcrumb shows the path, and gives a way up one level to the Rooms page:

<nav aria-label="Breadcrumb" class="crumbs">
  <ol>
    <li><a href="/">Home</a></li>
    <li><a href="/rooms">Rooms</a></li>
    <li><a href="/rooms/terrace" aria-current="page">Terrace Room</a></li>
  </ol>
</nav>

<style>
  .crumbs ol { display: flex; flex-wrap: wrap; list-style: none; padding: 0; }
  .crumbs a { display: inline-block; padding: 4px 0; }
  .crumbs li + li::before {
    content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 10px 2px 6px;
    border-top: 2px solid #475569; border-right: 2px solid #475569; transform: rotate(45deg);
  }
</style>

On a phone: visible links, a tab bar, or a hamburger

We measured Mrs. Sri's page at 375px wide, in Chromium, WebKit and Firefox. The result was the same in all three:

Pattern Links visible without a tap Smallest link box
Links on top, in their own row under the site name 4 of 4, fit in one row 63.1 × 48px
Bottom tab bar, icon and label 4 of 4 93.8 × 56px
Closed hamburger 0 of 4 Menu button 68 × 48px

The limits for a touch target (the area you can tap) from the Density & Scale lesson: WCAG 2.5.8 at least 24 × 24px, Apple 44 × 44pt, Material 48 × 48dp. All three patterns meet those limits. The difference is in which links are visible.

Mrs. Sri once thought of hiding all four links (Home, Rooms, Location, Bookings) behind a "Menu" button to keep things tidy. Do guests still use the navigation as often as when the links are visible? Guess before you look at the numbers.

Nielsen Norman Group (NN/g, a UX research company) tested this in 2016 with 179 participants and 6 sites. On phones, hidden navigation was used in 57% of cases. Partly visible navigation (some links showing, the rest in a menu) was used in 86% of cases. Tasks also took 15% longer when the navigation was hidden. On desktop the gap was wider: hidden navigation 27%, the others 48 to 50%. So the answer to the guess: no. What isn't visible gets used less.

Choices for Mrs. Sri:

⚠️ Navigation that gets guests lost

TL;DR: Navigation answers "where am I" and "where else can I go". Wrap it in <nav aria-label="...">: <nav> marks a block of navigation, and aria-label gives it a name (required when there's more than one <nav>). Mark the link to the open page with aria-current="page", on one link only. Then make that link bold through the same attribute in the CSS (nav a[aria-current="page"]), not with colour alone. Choose the pattern from how many destinations there are and how much they matter. Links on top suit a site with few pages. A bottom tab bar (a row of buttons at the bottom of the screen) suits 3 to 5 app destinations on a phone, and a sidebar (a menu column at the side) a big app on a wide screen. A breadcrumb (the path of pages, a numbered list <ol> inside <nav aria-label="Breadcrumb">) is for nested pages. A hamburger (a menu behind one button) is only for links that don't fit and are rarely used. A study by NN/g (a UX research company): on phones, hidden navigation was used in 57% of cases, partly visible navigation in 86%.

⚡ nav, and one current-page mark

Write:

<nav aria-label="Main navigation">
  <ul>
    <li><a href="/">Home</a></li>
    <li><a href="/rooms" aria-current="page">Rooms</a></li>
    <li><a href="/location">Location</a></li>
  </ul>
</nav>

<style>
  nav a[aria-current="page"] { color: #15803d; font-weight: 700; box-shadow: inset 0 -3px #15803d; }
</style>

Meaning: <nav> wraps the list of navigation links. It becomes a landmark (a jump point) that a screen reader, a program that reads the page aloud for blind users, can go to directly. aria-label gives it a name. aria-current="page" marks the link to the page that is open now, and goes on one link only. The CSS uses the same attribute as its selector (the part of CSS that picks which elements a rule styles), with weight and an underline, not colour alone.

⚡ A breadcrumb for nested pages

Write:

<nav aria-label="Breadcrumb" class="crumbs">
  <ol>
    <li><a href="/">Home</a></li>
    <li><a href="/rooms">Rooms</a></li>
    <li><a href="/rooms/terrace" aria-current="page">Terrace Room</a></li>
  </ol>
</nav>

Meaning: A breadcrumb shows the path from Home to this page. <ol> (a numbered list) is used because the order means something: from Home, down to Rooms, then to the Terrace Room. The last link goes to this page, so that link carries aria-current="page".

⚡ What's hidden gets used less

Guess first: four links are hidden behind a "Menu" button to keep things tidy. Do guests use the navigation as often as when the links are visible?

No. A 2016 study by NN/g (a UX research company): on phones, hidden navigation was used in 57% of cases, while partly visible navigation was used in 86%.

Meaning: Four short links fit in one row on a 375px phone, so just show them. A bottom tab bar (a row of buttons at the bottom of the screen) suits 3 to 5 app destinations. A hamburger (a menu behind one button) is only for links that don't fit and are rarely looked for.

What you will learn