# PageMenu

Supply UI 1.2.0. Layout.

A page with its own short menu beside it, like "On this page" (`side="start"` puts it before the page, like a settings menu; `foot` holds something at the foot of the menu, under a hairline, such as an `AccountMenu`; `title` shows a small heading above the entries, `label` only names it for screen readers; the entries are plain links with a hairline between them and an optional `icon`, the current one in the text colour; `back` is the way out of the area, first and set apart by space; an entry may have an `icon`): the screens of one area (settings, an account, a guide) beside the reading column, the current one highlighted (`active`). Where its box is too narrow for both, the menu goes above the page as one row that scrolls. For a whole app's sections use `Sidebar`

A page with its own short menu beside it, like "On this page" in a document (`side="start"` puts it before the page): the screens of one area (settings, an account, a guide) beside the reading column, the current one highlighted. Where its box is too narrow for both, the menu goes above the page as one row that scrolls.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `items` (needed) | `PageMenuItem[]` |  | The entries, in order. |
| `label` (needed) | `string` |  | The menu's name, read out by screen readers: "Admin", "Settings", "On this page". |
| `back` | `PageMenuItem` |  | The way out of the area, first and set apart from the entries by space: `{ href: '/', label: 'Back to Studio', icon }`. |
| `foot` | `ReactNode` |  | Something at the foot of the menu, set apart from the entries by space: an `AccountMenu`. |
| `side` | `"end" \| "start"` | `'end'` | Where the menu stands beside the page: `end` (after it, like "On this page") or `start` (before it, like a settings menu). |

It also takes the 280 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Without React

Classes: `div.ui-page-menu` > `.ui-page-menu-main` + `nav.ui-page-menu-nav`

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/page-menu.css`, besides the ones every page loads.

## Layout: notes

**States.** Layout follows the box it is in, not the window: `Split`, `Grid`, `AppShell` and the site parts stack when their box is narrow, at any width of the window.

**Do**
- Space with `gap` (`Stack`, `Row`, `Grid`), never with margins on children.
- Put the page's sections straight on the page, under their titles; a `Card` is one thing a person picks or acts on.
- Check every screen at 320, 375 and 768 px with the narrow check of rule 10.

**Don't**
- Don't give a box a fixed width, or a `min-height` together with an `aspect-ratio`.
- Don't nest a card in a card.
- Don't put two `<main>`s on a page: a screen shown inside another page takes `Main as="div"`.
