A positioned popover menu using native Popover API with Floating UI positioning
Context Menu
Code
<button id="ctx-trigger" popovertarget="ctx-menu">Actions ⋮</button>
<m-popover-menu id="ctx-menu" popover anchor="ctx-trigger">
<button type="button">Edit</button>
<button type="button">Delete</button>
<button type="button">Share</button>
</m-popover-menu> With Custom Role
This is a help dialog, not a menu.
Code
<button id="help-trigger" popovertarget="help-menu">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>
Help
</button>
<m-popover-menu id="help-menu" popover anchor="help-trigger" role="dialog">
<p>This is a help dialog, not a menu.</p>
</m-popover-menu> - anchor string —
- ID of anchor element
- adoptedStyleSheets array [baseStyleSheet]
- (default)
- Default slot for popover content