Components/Navigation/Navigation Menu
COMPONENT39.39

Navigation Menu

Site nav with accent-hover links and hover or click disclosure panels on the native Popover API.


INSTALL

1pnpm dlx @sayagodev/mo add navigation-menu

Or import the files from the package (no copy):

1import "@sayagodev/mo/css/navigation-menu.css";2import "@sayagodev/mo/js/navigation-menu.js";

EXAMPLES

Demo
Simple link list

USAGE

1<mo-navigation-menu>2  <nav data-navigation-menu aria-label="Main">3    <ul>4      <li><a href="#" data-navigation-link aria-current="page">Docs</a></li>5      <li>6        <button type="button" popovertarget="nm1">Components ▾</button>7        <div popover id="nm1" class="popover" data-width="lg">8          <ul data-columns="2">9            <li><a href="#">10              <div data-title>Alert Dialog</div>11              <div data-description>A modal dialog that interrupts the user.</div>12            </a></li>13          </ul>14        </div>15      </li>16    </ul>17  </nav>18</mo-navigation-menu>

API

NAMEKINDDESCRIPTION
<mo-navigation-menu>elementOrchestrator: hover-open (default) or click-only, aria-expanded sync, panel placement
data-openattribute"hover" (default, 200ms delay) · "click" (only explicit clicks open)
[data-navigation-link]attributeRoot link/trigger style: h-9 px-4, accent hover, chevron rotate while open
[data-width] / [data-columns]attributesm·lg panel widths; 1–3 column grids
[data-title] / [data-description]attributePanel item anatomy
--mo-navigation-item-height / -item-padding-xtokenRoot item height (h-9) and inline padding
--mo-navigation-panel-widthtokenPanel width (24rem; sm 16rem · lg 37.5rem via data-width)
--mo-navigation-columns / -gaptokenPanel grid columns and item gap

FILES

src/css/navigation-menu.csssrc/js/navigation-menu.js
Install:mo add navigation-menu

THEMING · PLAYGROUND

This is the exact component from the examples above, wearing a completely different theme. Edit the tokens and --mo-* hooks in the editor — autocomplete knows them all — and the preview obeys in real time. Your CSS always wins.

Tokens & hooks — edit live
Global tokens
--foreground--muted--muted-foreground--radius
Component hooks
--mo-navigation-columns--mo-navigation-gap--mo-navigation-item-height--mo-navigation-item-padding-x--mo-navigation-panel-width

Preview

Your CSS

Try it: type --mo- for the component hooks, or edit any value — the preview obeys in real time.