Navigation Menu
Horizontal navigation bar whose top-level items open dropdowns of links on hover or click. Each link can carry a one-line description.
<arc-navigation-menu>Overview
Navigation Menu is a horizontal nav bar for a site header. Each top-level <arc-nav-item> is either a link or a parent whose nested items open in a dropdown on hover, or on click for touch screens and keyboards. Use it when a site has several sections (products, solutions, resources) and listing every link in the header would crowd it.
A dropdown item can have a description, shown as a line of text under its label. With descriptions it works as a mega-menu, and without them it's a plain list of links.
Triggers are buttons, so Enter or Space opens a dropdown, and Escape closes it and returns focus to its trigger. Triggers carry aria-expanded and aria-haspopup, and dropdowns use role="menu" and role="menuitem". Following a link fires a cancelable arc-navigate event with the href, so a client-side router can call preventDefault() and handle the route itself.
When its container is 480px wide or narrower, the bar hides. The same items then open in a modal panel when a Top Bar with mobile-menu="nav" fires arc-mobile-menu-toggle from its menu button.
Guidelines
Do
- Keep top-level items to five or fewer
- Add descriptions to dropdown items when a label needs context
- Make single-destination items like "Pricing" plain links with no dropdown
- Set `active` on the NavItem that matches the current route
- Put it inside a Top Bar or a sticky header
Don't
- Don't nest NavItems more than one level deep. A dropdown renders only its direct children
- Don't use it alongside a Sidebar in the same view. Pick one navigation pattern
- Don't use it for links within a page. Use ScrollSpy or Tabs
- Don't leave out `href` on leaf items
- Don't put more than six or seven items in one dropdown. Split them into more top-level categories
Features
- Dropdowns fade and slide in
- A dropdown waits 150ms before closing when the pointer leaves, so moving from the trigger to the panel doesn't close it
- `active` on a NavItem gives it a tinted background, border and glow
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<script type="module" src="@arclux/arc-ui"></script>
<arc-navigation-menu label="Example menu">
<arc-nav-item>Products
<arc-nav-item href="#" description="Real-time dashboards and metrics">Analytics</arc-nav-item>
<arc-nav-item href="#" description="CI/CD pipelines and deployment">Automation</arc-nav-item>
<arc-nav-item href="#" description="Role-based access and SSO">Security</arc-nav-item>
</arc-nav-item>
<arc-nav-item>Solutions
<arc-nav-item href="#" description="Shared tooling for product teams">Engineering teams</arc-nav-item>
<arc-nav-item href="#" description="Infrastructure and monitoring">Platform teams</arc-nav-item>
<arc-nav-item href="#" description="Support plans and procurement">Enterprise</arc-nav-item>
</arc-nav-item>
<arc-nav-item href="#" variant="primary">Pricing</arc-nav-item>
<arc-nav-item href="#">Docs</arc-nav-item>
<arc-nav-item href="#" variant="muted">Blog</arc-nav-item>
<arc-nav-item href="#" variant="muted" active>Changelog</arc-nav-item>
</arc-navigation-menu>import { NavigationMenu, NavItem } from '@arclux/arc-ui-react';
export function SiteNav() {
return (
<NavigationMenu>
<NavItem>Products
<NavItem href="/analytics" description="Real-time dashboards and metrics">Analytics</NavItem>
<NavItem href="/automation" description="CI/CD pipelines and deployment">Automation</NavItem>
<NavItem href="/security" description="Role-based access and SSO">Security</NavItem>
</NavItem>
<NavItem>Solutions
<NavItem href="/engineering" description="Shared tooling for product teams">Engineering teams</NavItem>
<NavItem href="/platform" description="Infrastructure and monitoring">Platform teams</NavItem>
<NavItem href="/enterprise" description="Support plans and procurement">Enterprise</NavItem>
</NavItem>
<NavItem href="/pricing">Pricing</NavItem>
<NavItem href="/docs">Docs</NavItem>
</NavigationMenu>
);
}<script setup>
import { NavigationMenu, NavItem } from '@arclux/arc-ui-vue';
</script>
<template>
<NavigationMenu>
<NavItem>Products
<NavItem href="/analytics" description="Real-time dashboards and metrics">Analytics</NavItem>
<NavItem href="/automation" description="CI/CD pipelines and deployment">Automation</NavItem>
<NavItem href="/security" description="Role-based access and SSO">Security</NavItem>
</NavItem>
<NavItem>Solutions
<NavItem href="/engineering" description="Shared tooling for product teams">Engineering teams</NavItem>
<NavItem href="/platform" description="Infrastructure and monitoring">Platform teams</NavItem>
<NavItem href="/enterprise" description="Support plans and procurement">Enterprise</NavItem>
</NavItem>
<NavItem href="/pricing">Pricing</NavItem>
<NavItem href="/docs">Docs</NavItem>
</NavigationMenu>
</template><script>
import { NavigationMenu, NavItem } from '@arclux/arc-ui-svelte';
</script>
<NavigationMenu>
<NavItem>Products
<NavItem href="/analytics" description="Real-time dashboards and metrics">Analytics</NavItem>
<NavItem href="/automation" description="CI/CD pipelines and deployment">Automation</NavItem>
<NavItem href="/security" description="Role-based access and SSO">Security</NavItem>
</NavItem>
<NavItem>Solutions
<NavItem href="/engineering" description="Shared tooling for product teams">Engineering teams</NavItem>
<NavItem href="/platform" description="Infrastructure and monitoring">Platform teams</NavItem>
<NavItem href="/enterprise" description="Support plans and procurement">Enterprise</NavItem>
</NavItem>
<NavItem href="/pricing">Pricing</NavItem>
<NavItem href="/docs">Docs</NavItem>
</NavigationMenu>import { Component } from '@angular/core';
import { NavigationMenu, NavItem } from '@arclux/arc-ui-angular';
@Component({
imports: [NavigationMenu, NavItem],
template: `
<arc-navigation-menu>
<arc-nav-item>Products
<arc-nav-item description="Real-time dashboards and metrics"><a href="/analytics">Analytics</a></arc-nav-item>
<arc-nav-item description="CI/CD pipelines and deployment"><a href="/automation">Automation</a></arc-nav-item>
<arc-nav-item description="Role-based access and SSO"><a href="/security">Security</a></arc-nav-item>
</arc-nav-item>
<arc-nav-item>Solutions
<arc-nav-item description="Ship faster with integrated tooling"><a href="/engineering">Engineering Teams</a></arc-nav-item>
<arc-nav-item description="Unified observability stack"><a href="/platform">Platform Teams</a></arc-nav-item>
<arc-nav-item description="SOC 2 and HIPAA compliance"><a href="/enterprise">Enterprise</a></arc-nav-item>
</arc-nav-item>
<arc-nav-item><a href="/pricing">Pricing</a></arc-nav-item>
<arc-nav-item><a href="/docs">Docs</a></arc-nav-item>
</arc-navigation-menu>
`,
})
export class SiteNavComponent {}import { NavigationMenu, NavItem } from '@arclux/arc-ui-solid';
export function SiteNav() {
return (
<NavigationMenu>
<NavItem>Products
<NavItem href="/analytics" description="Real-time dashboards and metrics">Analytics</NavItem>
<NavItem href="/automation" description="CI/CD pipelines and deployment">Automation</NavItem>
<NavItem href="/security" description="Role-based access and SSO">Security</NavItem>
</NavItem>
<NavItem>Solutions
<NavItem href="/engineering" description="Shared tooling for product teams">Engineering teams</NavItem>
<NavItem href="/platform" description="Infrastructure and monitoring">Platform teams</NavItem>
<NavItem href="/enterprise" description="Support plans and procurement">Enterprise</NavItem>
</NavItem>
<NavItem href="/pricing">Pricing</NavItem>
<NavItem href="/docs">Docs</NavItem>
</NavigationMenu>
);
}import { NavigationMenu, NavItem } from '@arclux/arc-ui-preact';
export function SiteNav() {
return (
<NavigationMenu>
<NavItem>Products
<NavItem href="/analytics" description="Real-time dashboards and metrics">Analytics</NavItem>
<NavItem href="/automation" description="CI/CD pipelines and deployment">Automation</NavItem>
<NavItem href="/security" description="Role-based access and SSO">Security</NavItem>
</NavItem>
<NavItem>Solutions
<NavItem href="/engineering" description="Shared tooling for product teams">Engineering teams</NavItem>
<NavItem href="/platform" description="Infrastructure and monitoring">Platform teams</NavItem>
<NavItem href="/enterprise" description="Support plans and procurement">Enterprise</NavItem>
</NavItem>
<NavItem href="/pricing">Pricing</NavItem>
<NavItem href="/docs">Docs</NavItem>
</NavigationMenu>
);
}<arc-navigation-menu label="Example menu">
<arc-nav-item>Products
<arc-nav-item href="#" description="Real-time dashboards and metrics">Analytics</arc-nav-item>
<arc-nav-item href="#" description="CI/CD pipelines and deployment">Automation</arc-nav-item>
<arc-nav-item href="#" description="Role-based access and SSO">Security</arc-nav-item>
</arc-nav-item>
<arc-nav-item>Solutions
<arc-nav-item href="#" description="Shared tooling for product teams">Engineering teams</arc-nav-item>
<arc-nav-item href="#" description="Infrastructure and monitoring">Platform teams</arc-nav-item>
<arc-nav-item href="#" description="Support plans and procurement">Enterprise</arc-nav-item>
</arc-nav-item>
<arc-nav-item href="#" variant="primary">Pricing</arc-nav-item>
<arc-nav-item href="#">Docs</arc-nav-item>
<arc-nav-item href="#" variant="muted">Blog</arc-nav-item>
<arc-nav-item href="#" variant="muted" active>Changelog</arc-nav-item>
</arc-navigation-menu><!-- arc-navigation-menu is hybrid — CSS handles layout, JS enhances interactivity -->
<arc-navigation-menu></arc-navigation-menu>API
labelstring'Navigation menu'
Events
arc-mobile-menu-toggledetail:{ value: boolean }- Fired when the mobile hamburger button is clicked. Bubbles composed from the host, so listening on the element or on document both work.
arc-navigate- Fired when a navigation item is selected
See also
- SidebarA vertical list of navigation links in grouped sections that can collapse, with the current page highlighted.
- Top BarThe header bar across the top of an app, with the brand on the left and user controls on the right.
- BreadcrumbA trail of links from the site root down to the current page.
- TabsA row of tab buttons that shows one of several panels at a time.