Navigation menu

From thedaviddias/ux-patterns-for-developers · View interactive version

Navigation menu is an AI agent skill from the GitHub repository thedaviddias/ux-patterns-for-developers. Use when you need to organize and structure site navigation.

How to use this skill

Skill file

Navigation Menu

Organize and structure site navigation

What it solves

Navigation Menu is the primary horizontal or vertical bar of links that helps users move between the main sections of a website or application. It is the backbone of site architecture, giving users a persistent map of what the site offers and where they currently are.

A well-built navigation menu balances visibility, hierarchy, and responsiveness — always adapting to viewport size while remaining accessible to keyboard and screen reader users.

When to use

Use Navigation Menu to provide persistent, structured access to the main sections of a website or app.

Common scenarios include:

When to avoid

Implementation workflow

  1. Confirm the pattern matches the problem and constraints before copying the example.
  2. Start from the anatomy and examples in references/pattern.md, then choose the smallest viable variation.
  3. Apply accessibility, performance, and interaction guardrails before layering visual polish.
  4. Use the testing guidance to verify behavior across keyboard, screen reader, responsive, and failure scenarios.

Accessibility guardrails

Do's ✅

Don'ts ❌

Performance guardrails

Target Metrics

Optimization Strategies

Semantic HTML (No JS Needed for Basic Nav)```html

<nav aria-label="Main navigation">

<ul>

Common mistakes

Too Many Top-Level Items

The Problem:

Cramming 10+ items into the primary navigation bar causes wrapping, overflow, or truncated labels.

How to Fix It:

Limit to 5-7 top-level items. Group excess items under broader categories or move them to a secondary navigation bar.

No Active State Indication

The Problem:

Users can't tell which page they're on because no navigation item is visually highlighted.

How to Fix It:

Style the current page's navigation link distinctly (color, weight, underline) and add aria-current="page" for screen readers.

Dropdown Opens on Hover Only

The Problem:

Keyboard users and touch-device users cannot access dropdown submenus that only respond to mouse hover.

How to Fix It:

Use click/tap to toggle dropdowns. Support Enter/Space to open and Escape to close for keyboard users.

Related patterns


For full implementation detail, examples, and testing notes, see references/pattern.md.

Pattern page: https://uxpatterns.dev/patterns/navigation/navigation-menu

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.