Menus

A website can have any number of named menus. The names header, footer, and docs are the ones every theme shows: header at the top, footer at the bottom, and docs beside the docs pages.

!The Menus screen of a website with each menu and its links.

!The Menus screen of a website with each menu and its links, in dark mode.

!The Menus screen of a website with each menu and its links, on a phone.

!The Menus screen of a website with each menu and its links, on a phone in dark mode.

  • See the menus (action sites.menu.list).
  • Save a menu (action sites.menu.save): a list of up to 30 items, each with a label and a link, and up to 20 sub items under an item. Links follow the same rules as links on pages.
  • Remove a menu, or bring it back (action sites.menu.remove): hidden and kept.

A menu name uses lower case letters, numbers, and dashes.

In the header menu, an item with sub items is drawn as a dropdown: it opens when a visitor hovers it, tabs to it, or taps its arrow, and closes with Esc and when focus or a tap leaves it. On a phone the menu opens inside a Menu button. A small script from the website's own address (/_mdo/menu.js) does this; without it the sub items show as a stacked list, so the website always works. The dropdown fades in and out, and respects reduced motion. A website published before this existed keeps its stored build and its nested list: a dropdown starts only at the owner's next publish.

There is one level of sub items. A sub item cannot have sub items of its own, and saving one is refused with "Menus go two levels deep. Move this item up a level." (the same for a person, an API key, and an AI agent). In the editor, write each item as Label | Link and put - at the start of a line to make it a sub item of the item above it. The editor shows a preview of the open dropdown.

Where to Find It

Websites, then Menus. Anyone who may see websites sees it; saving a menu needs edit access.