Components/Navigation/Menubar
COMPONENT36.36

Menubar

Horizontal bar of root menus on the Popover API, with arrow-key travel between open menus.


INSTALL

1pnpm dlx @sayagodev/mo add menubar

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

1import "@sayagodev/mo/css/menubar.css";2import "@sayagodev/mo/css/shared.css";3import "@sayagodev/mo/js/menubar.js";

EXAMPLES

Demo










Checkboxes

Radio groups

With icons


Submenu



USAGE

1<mo-menubar>2  <button role="menuitem" popovertarget="m-file">File</button>3  <menu popover id="m-file">4    <button role="menuitem">Open <span data-shortcut>⌘O</span></button>5    <button role="menuitem" popovertarget="s-share">Share…</button>6    <menu popover id="s-share">7      <button role="menuitem">Email link</button>8    </menu>9  </menu>10</mo-menubar>

API

NAMEKINDDESCRIPTION
<mo-menubar>elementBar of root menus; full dropdown keyboard model per segment
> [popovertarget] + > menu[popover]attributeRoot trigger/surface pairs by id
[data-label] / [data-shortcut] / [data-inset]attributeHeading · key hint · alignment
--mo-menubar-height / -gaptokenBar height and spacing between triggers
--mo-menubar-min-width / -radiustokenOpen menu minimum width and corner radius

FILES

src/css/menubar.csssrc/css/shared.csssrc/js/menubar.js
Install:mo add menubar

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
--accent--accent-foreground--background--border--destructive--foreground--muted--muted-foreground--popover--popover-foreground--radius--ring
Component hooks
--mo-menubar-gap--mo-menubar-height--mo-menubar-min-width--mo-menubar-radius

Preview

Your CSS

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