Action menu
<forma-menu>
A Popover-backed ordinary action list with light physics-derived motion; full ARIA menu behavior remains application-owned.
- Authoring tag
<forma-menu>- Category
- Overlays and disclosure
- Behavior owner
- Native HTML
- Canonical source
patterns/menu.html
Purpose
An action menu reveals a short list of actions from one trigger button, such as the More actions button on a record. It is a popover element with class="forma-menu" holding an forma-menu__list of ordinary buttons and links, opened by a button with popovertarget. The browser owns opening, light dismiss (outside click, Escape) and tab order from the trigger into the list. Forma provides the surface, full-width 44px rows with hover feedback, viewport-bounded sizing and light entry and exit motion. This is deliberately not an ARIA role="menu": items are reached with Tab, not arrow keys. Arrow-key roving focus, typeahead, checkable items, submenus and closing after an action are application or Limen behavior.
Use when
- A record, row or card has several secondary actions that would crowd the layout if shown as buttons.
- The actions are a mix of commands (buttons) and destinations (links).
- A no-script baseline is needed that still opens, closes and is keyboard reachable.
Avoid when
- There are only one or two actions: show them as Buttons.
- The actions should stay in the page flow and push content down: use Overflow command disclosure.
- The user picks a value (sort order, view): use Select or Segmented control.
- The content is explanatory rather than a list of actions: use Popover.
- Users search many commands by name: use Command palette.
Behavior to know
- Opacity fades in and out over the shared fast duration (120ms by default), gently starting, accelerating through the middle, then settling. CSS-only; reduced motion is immediate.
- Items are native buttons and links in a list; each fills the menu width and is at least 44px tall.
- Minimum width
min(14rem, 100vw - 2rem), maximummin(30rem, 100vw - 2rem); long lists scroll inside. - Opening the menu does not move focus; Tab from the trigger enters the list.
- Forma does not anchor the menu to its trigger; it opens at the viewport's block-start, inline-start corner unless the application positions it.
Basic example
The smallest correct markup: the canonical pattern from patterns/menu.html inside its public tag. Copy this first, then adapt labels, names and state.
Minimal action menu
Rendered from the canonical pattern file.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
<forma-menu class="forma-component-tag">
<button type="button" popovertarget="record-actions">More actions</button>
<div class="forma-menu" id="record-actions" popover data-forma-motion-weight="light">
<ul class="forma-menu__list">
<li><button type="button">Duplicate record</button></li>
<li><button type="button">Export record</button></li>
<li><button type="button">Archive record</button></li>
</ul>
</div>
</forma-menu>
Click or tap the code once to select all of it, then copy.
Examples
Row actions mixing links and commands
Actions for one invoice in a table row. View and Download are links (navigation, so the page change closes the menu); Duplicate and Void are buttons whose effects, and closing the menu afterwards, belong to the application. The trigger names its object so several row menus are distinguishable.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its links point to placeholder destinations that do not exist on this site. Its controls are shown for their markup and appearance and cannot be operated here.
<forma-menu class="forma-component-tag">
<button type="button" popovertarget="menu-row-actions-mixed">Actions for INV-20931</button>
<div class="forma-menu" id="menu-row-actions-mixed" popover>
<ul class="forma-menu__list" aria-label="Actions for INV-20931">
<li><a href="#menu-row-actions-mixed-view">View invoice</a></li>
<li><a href="#menu-row-actions-mixed-pdf">Download PDF</a></li>
<li><button type="button">Duplicate invoice</button></li>
<li><button type="button">Void invoice</button></li>
</ul>
</div>
</forma-menu>
Click or tap the code once to select all of it, then copy.
Mobile
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
Mobile · 320px
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
Static specimen. Its buttons stand for application actions that the consuming application implements; this script-free documentation does not perform them. Its controls are shown for their markup and appearance and cannot be operated here.
API and configuration
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
popover | .forma-menu | auto (empty) | manual | auto | Makes the menu a popover. Keep auto so outside click and Escape close it. |
popovertarget | trigger button | id of the menu | — | Connects the trigger to the menu; toggles it. |
aria-label | .forma-menu__list | string | — | Optional name for the list, usually the trigger's label. |
disabled | item button | boolean | absent | Native disabled command: skipped by Tab and not activatable. No additional styling is applied. |
data-forma-motion-weight | .forma-menu | light | standard | heavy | light | Presentation-only perceived mass for entry and exit. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-menu | Block class | — | The popover surface for an action list: shares the Popover surface, entry/exit transition and viewport bounds, with a 14rem minimum width and tighter 0.4rem padding. |
.forma-menu__list | Element class | — | Unstyled list (no markers or padding) in a grid with a small gap. Its buttons and links become full-width, 44px, borderless, start-aligned rows with a secondary-surface hover. |
[data-forma-motion-weight] | Attribute hook | "heavy", "light", "standard" | Presentation-only perceived mass: light (default for menus), standard or heavy. |
| Keys | Result |
|---|---|
| Enter / Space on the trigger | Opens or closes the menu. Focus stays on the trigger. |
| Tab / Shift+Tab | From the trigger, moves through the menu items in order, then onward to the page. There is no arrow-key navigation unless the application adds it. |
| Enter / Space on an item | Activates the button or follows the link. |
| Escape | Closes the menu and returns focus to the trigger if focus was inside. |
| Event | Description |
|---|---|
toggle / beforetoggle | Native popover events on the menu when it opens or closes. |
click | Native click on each item. The menu stays open after a button is activated unless the application hides it. |
Form behavior
The menu does not participate in forms. Item buttons should be type="button".
States
| State | How it is expressed | Presentation |
|---|---|---|
| Closed | not :popover-open | Hidden; while closing it fades in place before display and top-layer removal. |
| Open | :popover-open | Shown in the top layer over the page, which stays interactive. |
| Item hover | :hover on an item | Secondary surface behind the row. |
| Item focus | :focus-visible on an item | Shared two-tone focus ring. |
| Item disabled | disabled on an item button | Not focusable or activatable; visually unchanged apart from missing hover, so the label must explain. |
Accessibility
Forma provides
- Uses native popover open/close, light dismiss and trigger-to-content focus order.
- Keeps every item a native button or link with a 44px minimum height and full-width hit area.
- Keeps the surface within the viewport, with a visible border in forced-colors mode.
Your application supplies
- Label the trigger with what the menu is for, including the object for repeated menus.
- Do not add
role="menu"/menuitemunless you also implement the full ARIA menu keyboard model in Limen/application code. - Close the menu after a command runs if that is the expected behavior (for example by hiding the popover in application code).
- Explain unavailable items in their labels, and confirm destructive actions with a Dialog.
- Position the menu near its trigger if proximity matters; Forma does not.
Responsive behavior
- Above 44rem: width between
min(14rem, 100vw - 2rem)andmin(30rem, 100vw - 2rem), height at mostmin(80dvh, 100dvh - 2rem). - At 44rem and below: may grow to
100vw - 1remwide and100dvh - 1remtall. - Item labels wrap inside the row; extra items scroll inside the menu.
- No anchor placement, collision handling or bottom-sheet presentation is provided.
Motion
- Entry and exit: opacity alone follows the shared 120ms slow-fast-slow curve, at unchanged position and size.
- Display and top-layer placement remain until opacity is zero where retention is supported; otherwise dismissal is immediate.
- Item hover is an instant background change (no transition).
data-forma-motion-weightremains available for other spatial tracks; it does not affect these perceptual fades. The native open state is authoritative.- Under
prefers-reduced-motion: reducethe stationary fade reaches its endpoint effectively immediately.
Motion weights
Forma motion is physics-derived: perceived mass changes how a surface accelerates and settles, never what state it is in. Compare the three presentation weights of the same markup:
Usage guidance
Do
- Keep menus to about seven items, grouped by frequency, with destructive actions last.
- Use verbs plus objects for item labels.
Avoid
- Hiding the only path to a frequent or critical action in a menu.
- Nesting menus inside menus.
- Mixing selection state (checkmarks) into an action menu without implementing menu semantics.
Verification specimens
Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.