# MenuItem

Supply UI 1.1.0. On top of the page, part of `Menu`.

Actions on a thing (the "⋯" button of a row). `shortcut="mod+s"` shows the key the way the person's computer writes it; it is a hint, your code handles the key itself with `useShortcut`

One action in a menu. `shortcut` shows its key as a hint; your code handles the key itself.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `className` | `string` |  | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
| `danger` | `boolean` |  | In the danger colour, for an action that deletes or cannot be undone. |

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

## CSS parts

With the CSS in parts (`/ui/css/`), it needs: `components/button.css`, `components/popups.css`, `components/icons.css`, `components/menu-items-tick.css`, `components/prose.css`, `parts/listbox.css`, `parts/menubar.css`, besides the ones every page loads.

## In the examples

- More on right-click: The actions of a row, where the hand already is (https://www.supply.family/ui/#scene-right-click)
- File, View, the old way: Menus of an application, ticks and choices included (https://www.supply.family/ui/#scene-editor-menus)

## On top of the page: notes

**States.** Closed, opening (fades and rises), open, closing (fades before what it changed appears: `afterClose`). While open, focus is inside and Escape closes it; when it closes, focus goes back to what opened it.

**Do**
- Name every dialog, drawer and popover (`DialogTitle`, `DrawerTitle`, or `aria-label`).
- Use `AlertDialog` for anything that cannot be undone, with the action named on its button ("Delete 3 files").
- Use a `Drawer` on a phone for what a `Popover` does on a computer.

**Don't**
- Don't open a dialog from a dialog; change what the open one shows instead.
- Don't put the only way to do something in a right-click menu or a tooltip.
- Don't use a toast for something the person must not miss: that is an `Alert` on the page.
