Context action menus
Expose related record-level actions through an accessible menu trigger.
Live preview
Design specification
HTML
<div class="xsh-row">
<span>Design specification</span>
<div class="xsh-menu-shell" data-xsh-menu>
<button class="xsh-button xsh-button--secondary xsh-button--sm" data-xsh-menu-trigger aria-haspopup="menu" aria-expanded="false">Actions ⋯</button>
<div class="xsh-menu" role="menu" aria-label="Record actions" hidden>
<button role="menuitem" data-xsh-toast="info" data-xsh-message="Duplicate chosen">Duplicate</button>
<button role="menuitem" data-xsh-toast="warning" data-xsh-message="Archive chosen">Archive</button>
</div>
</div>
</div>Installation & markup
Include the local stylesheet and script once on the page, then place the component inside a data-xsh-ui root. The example above works without a build system.
<link rel="stylesheet" href="/dist/xshna-ui.css">
<div data-xsh-ui>
<!-- Add the HTML example above -->
</div>
<script defer src="/dist/xshna-ui.js"></script>Component API
Public classes, attributes and hooks used by this example. Keep the xsh- prefix intact.
| Identifier | Contract |
|---|---|
xsh-menu-shell | Used by the example markup and component styles or behavior. |
data-xsh-menu | Used by the example markup and component styles or behavior. |
role=menu | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Supports arrow keys, Escape, Enter and menu-item selection.
Implementation note. This is a keyboard-accessible action menu, not a pointer-only right-click implementation.
Interaction contract
Behavioral components use the shared delegated runtime; visual-only primitives rely on semantic HTML and CSS. Runtime controls emit bubbling xsh:* CustomEvents; bind application handlers to those events when server persistence, API data or navigation is required.