Machine-translated – improvements welcome. Suggest an improvement
Menu¶
Menue (#1211, #1212) is a button that opens a list of actions: Folder ▾ in the header of a folder and ⋯ on every document row. All menus look and work the same.
What it is for¶
For several actions on one thing that should not all stand there as buttons – on a row, on a list, in the header of a folder. A single action is a Button; a choice of values is a select in a Field or a Multiple selection. A menu that only starts something new (“+ New” in the header) is a menu of the kind anlegen.
Matching patterns in the pattern catalogue: C18 · Position of menus: below if there is room, otherwise above, never over the assistant, C14 · Kinds of buttons: fixed, the same everywhere, B4 · Confirmations in Ablago's own dialog, D6 · On the phone.
How to use it¶
| With | How it works |
|---|---|
| Mouse | A click on the button opens the list, a click on an item runs it. A click outside closes it. An item with danger asks first (Confirmation). |
| Keyboard | Following WAI-ARIA (menu button): Enter, Space or Arrow down open it and focus the first item; arrow keys, Home and End move; Esc closes and returns focus to the button. |
| Touch | On the phone the menu opens as a sheet from the bottom; every item is at least 48 px high. |
What it means¶
- “▾” after the label or “⋯” means: there are several actions here. A green button with “+” and no arrow only starts something new.
- Groups with a heading keep together what belongs together (on documents: view, download, edit, organise). Items without an icon keep the space so the texts line up.
- Locked items are quiet, with the reason small below the item, not only in the tooltip (principle 6).
- Danger is set apart at the end and not red at rest; it turns red only under the mouse or the focus, filled red only in the confirmation.
Position¶
Position (#1488): the open list is fixed in the window (position: fixed), below the button when there is room – the assistant's space at the bottom right (--platz-begleiter) does not count as room – otherwise above it. If it fits nowhere completely, it takes the side with more room and scrolls inside. So a menu never lengthens a column and never adds a page scrollbar. It follows when scrolling or resizing. Horizontally (#1556) it is aligned with the preferred edge of the button (right, with links left) if it fits into the window there, otherwise with the other edge; if neither fits, 8 px from the window edge. The pattern lives in web/src/bausteine/menue/lage.ts (aufklapplage, legeFest) – for everything that pops open, including the calendar of Date.
States¶
| State | How it comes about | How it looks |
|---|---|---|
| closed | – | button with “▾” or “⋯” (Button, kind secondary) |
| open | click, Enter, Arrow down | list below or above the button, on the phone a sheet from the bottom |
| item under mouse or focus | – | surface --senke, with focus a ring inside in --akzent |
| with groups | gruppe |
heading per group, a line between them |
| locked item | gesperrt |
quiet, reason small below it |
| danger | gefahr |
set apart at the end; under mouse and focus text, icon and ring in --schlecht |
| create | art="anlegen" |
green button with “+”, no arrow |
Accessibility¶
- The button has
aria-haspopup="menu",aria-expandedandaria-controls; withnurSymbol,beschriftungis its name (“More actions for invoice.pdf”). - The list is
role="menu"with a name, every itemrole="menuitem", groupsrole="group"with a name and separators (role="separator"). - Locked items are
aria-disabledand are skipped when opening; danger items havearia-haspopup="dialog"– they open a confirmation. - Icons are
aria-hidden. Errors fromtu(rejected promise) appear in a message window.
Code¶
import { Menue } from '../bausteine';
<Menue beschriftung={t('ablage.dokumente.mehr', { name: d.name })} nurSymbol punkte={[
{ key: 'tab', gruppe: t('…gruppe.ansehen'), symbol: 'extern', inhalt: t('…in-neuem-tab-oeffnen'), tu: oeffnen },
{ key: 'weg', symbol: 'geloescht', inhalt: t('…mappe-mit-verknuepften'), tu: loeschen,
gefahr: { titel: t('…frage'), ja: t('…loeschen'), mitGrund: true } },
]} />
| Prop | Purpose |
|---|---|
beschriftung |
text of the button (“Folder”); with nurSymbol the name for screen readers (“More actions for invoice.pdf”) |
nurSymbol |
show only “⋯” |
art |
neben (default) or anlegen: green create button without an arrow for a menu that only starts something new – “+ New” in the header (#1269); the label starts with “+” |
punkte |
the actions, see below |
groesse |
klein (default) or normal |
links |
list left-aligned below the button instead of right-aligned |
titel, anker |
tooltip of the button; jump target for tours and tips (data-anker) |
An item (MenuePunkt) has key, inhalt and tu(anlass?), plus optionally:
symbol– icon fromSymbol.tsx; items without an icon keep the space so the texts line up.gruppe– heading of the group; items of the same group stay together (on documents: view, download, edit, organise).gesperrt– reason as text; it appears small below the item, not only in the tooltip (principle 6).gefahr– a confirmation as on the button (titel,text,ja, optionallymitGrund). Such items are set apart at the end, not red at rest;tuonly runs after “Yes” and receives the chosen reason.titel– short explanation as a tooltip, in addition to the text.
Files and tests¶
- Building block:
web/src/bausteine/menue/Menue.tsx, look:Menue.module.css, position:lage.ts - Pattern page:
web/src/bausteine/menue/muster.tsx– section Menu: with groups, a locked item and danger - Test:
web/test/baustein-menue-lage.test.ts

