Overlays and disclosure

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>
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

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), maximum min(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.

Canonical

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.

HTML · Minimal action menu Raw HTML for HTML · Minimal action menu
<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

Scenario

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.

HTML · Row actions mixing links and commands Raw HTML for HTML · Row actions mixing links and commands
<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.

Scenario

Unavailable action and long labels

A standard-weight menu with one natively disabled action and long, translated labels. Labels wrap inside their rows rather than widening the menu past its 30rem limit. The disabled item is skipped by Tab; its label says why it is unavailable because Forma adds no disabled styling to menu items.

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.

HTML · Unavailable action and long labels Raw HTML for HTML · Unavailable action and long labels
<forma-menu class="forma-component-tag">
  <button type="button" lang="de" popovertarget="menu-unavailable-and-long-labels">Weitere Aktionen</button>
  <div class="forma-menu" id="menu-unavailable-and-long-labels" lang="de" popover data-forma-motion-weight="standard">
    <ul class="forma-menu__list" aria-label="Weitere Aktionen">
      <li><button type="button">Projekt in einen anderen Arbeitsbereich verschieben</button></li>
      <li><button type="button">Alle Mitglieder über Änderungen benachrichtigen</button></li>
      <li><button type="button" disabled>Projekt archivieren (nur für Eigentümer)</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 example

Record menu on a phone

A five-item menu at phone width. The menu is bounded to the viewport and its rows keep full touch targets.

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.

Viewport width

Frames narrower than the selected width show the component at the width available.

What changes at narrow widths

  • At 44rem and below the menu may grow to 100vw - 1rem wide and 100dvh - 1rem tall; its minimum width stays min(14rem, 100vw - 2rem).
  • Each item spans the menu width and is at least 44px tall, so rows are easy to tap.
  • If the list is taller than the viewport it scrolls inside the menu with contained overscroll.
  • Tapping outside the menu or pressing Escape closes it; there is no hover-only path.
  • Without application positioning the menu sits at the top-start corner of the viewport, which keeps it fully on screen at 320px.
HTML · Record menu on a phone Raw HTML for HTML · Record menu on a phone
<forma-menu class="forma-component-tag">
  <button type="button" popovertarget="menu-mobile-record-menu">More actions</button>
  <div class="forma-menu" id="menu-mobile-record-menu" popover>
    <ul class="forma-menu__list" aria-label="More actions">
      <li><button type="button">Edit details</button></li>
      <li><button type="button">Change owner</button></li>
      <li><button type="button">Copy link</button></li>
      <li><a href="#menu-mobile-record-menu-history">View history</a></li>
      <li><button type="button">Delete record</button></li>
    </ul>
  </div>
</forma-menu>

Click or tap the code once to select all of it, then copy.

Baseline

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.

Viewport width

Frames narrower than the selected width show the component at the width available.

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.

Native and ARIA attributes
AttributeOnValuesDefaultDescription
popover.forma-menuauto (empty) | manualautoMakes the menu a popover. Keep auto so outside click and Escape close it.
popovertargettrigger buttonid of the menu—Connects the trigger to the menu; toggles it.
aria-label.forma-menu__liststring—Optional name for the list, usually the trigger's label.
disableditem buttonbooleanabsentNative disabled command: skipped by Tab and not activatable. No additional styling is applied.
data-forma-motion-weight.forma-menulight | standard | heavylightPresentation-only perceived mass for entry and exit.
CSS hooks (derived from dist/all.css)
HookKindValues or defaultDescription
.forma-menuBlock 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__listElement 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.
Keyboard interaction
KeysResult
Enter / Space on the triggerOpens or closes the menu. Focus stays on the trigger.
Tab / Shift+TabFrom 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 itemActivates the button or follows the link.
EscapeCloses the menu and returns focus to the trigger if focus was inside.
Events
EventDescription
toggle / beforetoggleNative popover events on the menu when it opens or closes.
clickNative 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

Action menu states
StateHow it is expressedPresentation
Closednot :popover-openHidden; while closing it fades in place before display and top-layer removal.
Open:popover-openShown in the top layer over the page, which stays interactive.
Item hover:hover on an itemSecondary surface behind the row.
Item focus:focus-visible on an itemShared two-tone focus ring.
Item disableddisabled on an item buttonNot 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"/menuitem unless 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) and min(30rem, 100vw - 2rem), height at most min(80dvh, 100dvh - 2rem).
  • At 44rem and below: may grow to 100vw - 1rem wide and 100dvh - 1rem tall.
  • 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-weight remains available for other spatial tracks; it does not affect these perceptual fades. The native open state is authoritative.
  • Under prefers-reduced-motion: reduce the 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:

lightpresentation only
standardpresentation only
heavypresentation only

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.