一键导入
hambuger-menu
Use when you need to display a menu icon for mobile devices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when you need to display a menu icon for mobile devices.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when implementing help users understand their current location.
Use when implementing expand and collapse content sections.
Use when implementing user account configuration and preferences.
Use when implementing social activity and updates stream.
Use when implementing conversational AI chat interfaces.
Use when implementing handling AI-specific errors.
| name | hambuger-menu |
| description | Use when you need to display a menu icon for mobile devices. |
| metadata | {"id":"hambuger-menu","category":"navigation","pattern":"Hamburger Menu","source":"uxpatterns.dev","url":"https://uxpatterns.dev/patterns/navigation/hambuger-menu","sourcePath":"apps/web/content/patterns/navigation/hambuger-menu.mdx"} |
Display a menu icon for mobile devices
Hamburger Menu is a three-line icon (☰) that toggles a hidden navigation panel, primarily on mobile and small-screen devices. Tapping or clicking the icon reveals the site's navigation, then hides it again when dismissed. This pattern conserves screen real estate on smaller viewports while keeping the full navigation accessible behind a single, universally recognized affordance.
Use Hamburger Menu to provide full navigation access on small screens without consuming permanent layout space. Common scenarios include:
references/pattern.md, then choose the smallest viable variation.Do's ✅
<button> element with aria-expanded and aria-controlsaria-label on the toggle to describe its current action ("Open menu" / "Close menu")aria-expanded
Don'ts ❌<div> or <span> as the toggle elementCSS-Only Toggle (Progressive Enhancement)
/* Use :has() or checkbox hack for no-JS base */
.nav-panel { transform: translateX(-100%); }
.hamburger-toggle[aria-expanded="true"] ~ .nav-panel {
transform: translateX(0);
}
The Problem: Hiding navigation behind a hamburger icon on large screens reduces discoverability and forces unnecessary clicks.
How to Fix It: Only use the hamburger pattern below a responsive breakpoint (typically 768px or 1024px). Show full navigation on desktop.
The Problem: When the menu opens, focus stays on the toggle or moves to the page body, leaving keyboard users stranded.
How to Fix It: Move focus to the first focusable element inside the panel on open. Trap focus within the panel. Return focus to the toggle on close.
The Problem: Keyboard users have no way to quickly dismiss the menu without tabbing to a close button.
How to Fix It:
Listen for the Escape key and close the menu, restoring focus to the toggle button.
For full implementation detail, examples, and testing notes, see references/pattern.md.
Pattern page: https://uxpatterns.dev/patterns/navigation/hambuger-menu