Context Menu overview
Headless context menu adds right-click and keyboard context invocation on top of tngMenu while leaving the trigger surface, panel placement, and styling in your hands.
Primitive imports
ts
import {
TngContextMenu,
TngContextMenuTrigger,
TngMenu,
TngMenuGroupLabel,
TngMenuItem,
TngMenuSeparator,
} from '@tailng-ui/primitives';
Basic composition
Apply tngContextMenuTrigger to any focusable target, then add tngContextMenu on the menu host that already owns tngMenu. The exported instance exposes whether the menu opened from a pointer or keyboard anchor.
Headless context-menu composition
html
<div class="context-shell">
<div tabindex="0" [tngContextMenuTrigger]="assetMenu">Right-click target</div>
<div tngMenu tngContextMenu #assetMenu="tngContextMenu" aria-label="Asset actions">
<button type="button" tngMenuItem tngMenuItemValue="rename">Rename</button>
<button type="button" tngMenuItem tngMenuItemValue="archive">Archive</button>
</div>
</div>
<!-- Read assetMenu.getAnchorType() / getPointerAnchor() when you want cursor placement. -->
Style variants
The same primitive markup rendered through a plain CSS contract or wrapper-scoped Tailwind selectors.
Headless context menu (plain CSS)
Right-click this release row for contextual actions.
Release
Last command: No command yet
Headless context menu (Tailwind CSS)
Right-click this asset row for contextual actions.
Last command: No command yet
Keyboard baseline
Shift + F10orContextMenuopens from the focused target.ArrowDown/ArrowUptraverses enabled actions.Enter/Spaceactivates the highlighted action.Escapecloses the menu and restores focus to the trigger target.