# AccountMenu

Supply UI 1.2.0. Layout.

Who is signed in: their picture (their initials without one), name and email in one row at the foot of a sidebar or of a `PageMenu` (`compact`: only the picture, for a top bar, with `side="bottom"`), opening a menu with Settings (`settingsHref`, for someone allowed to change them), their account page (`accountHref`, in a new tab, named by `accountLabel`) and Sign out (`signOutAction`, sent as a POST). Leave out what someone may not do. `note` is one quiet line at the top of the menu, such as who a stand-in is. The name and picture come from the account that signs people in: an app shows them, never changes them

Who is signed in, and what they can do with their account: their picture, name and email, and a menu with Settings, their account page and Sign out. The same in every screen of an app, at the foot of the sidebar or in the top bar. The person's name and picture come from the account that signs them in; the app never lets them be changed here.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `name` (needed) | `string` |  | The person who is signed in. |
| `accountHref` | `string` |  | Where they change their own account (name, picture, password), on the site that signs them in. Opens in a new tab. |
| `accountLabel` | `string` |  | The name of that account page: "Your account" by default. |
| `align` | `"end" \| "start"` | `'start'` | Which edge of the trigger the menu lines up with: `start` (the default) or `end`, for a trigger at the end of a top bar. |
| `className` | `string` |  | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
| `compact` | `boolean` |  | Only the picture, for a top bar. Its name is still read out. |
| `email` | `string` |  | Their email, shown under the name. |
| `note` | `ReactNode` |  | One quiet line at the top of the menu: who this stand-in is, why there is no Sign out. |
| `picture` | `null \| string` |  | The address of their picture. Left out, or if it fails, their initials show. |
| `settingsHref` | `string` |  | Where the settings of what they are using are, for someone allowed to change them. Left out, there is no Settings. |
| `side` | `"top" \| "bottom"` | `'top'` | Where the menu opens: `top` for the foot of a sidebar (the default), `bottom` for a top bar. |
| `signOutAction` | `string` |  | The address Sign out sends a POST to. Left out, there is no Sign out (a stand-in, a demo). |

## Without React

Classes: `button.ui-account` (+ `--compact`) > `.ui-avatar` + `.ui-account-text`; menu `.ui-account-menu`

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/avatar.css`, `components/account-menu.css`, `parts/avatar.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"`.
