Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

Chapter 03 Actions

Context menu

Actions that open where the reader right-clicks, long-presses, or presses Shift+F10 on the focused item. It is a shortcut: the same actions must also be somewhere visible, because touch and keyboard users rarely look for one.

Use it in Angular
import {
  ContextMenuTriggerDirective,
  MenuComponent,

On a file

Right-click the file, or Tab to it and press Shift+F10.

invoice-1042.pdf

Angular
<div tabindex="0" [uiContextMenu]="fileActions">invoice-1042.pdf</div>
<ng-template #fileActions>
  <ui-menu>
    <button ui-menu-item (triggered)="rename()">Rename</button>
    <button ui-menu-item (triggered)="copy()">Make a copy</button>
    <button ui-menu-item danger (triggered)="remove()">Delete</button>
  </ui-menu>
</ng-template>

When to use something else

If you needUse
The visible way to the same actionsMenu
Actions that should always be on screenToolbar
Search every command in the appCommand palette

Inputs

NameTypeDefaultWhat it does
uiContextMenuTemplateRef — On the area that opens it: an ng-template holding a <ui-menu>. Make the area focusable.
uiContextMenuDisabledbooleanfalseRight-click shows the browser menu instead.
<button ui-menu-item>component — One action, as in Menu: (triggered) fires for click, Enter and Space; danger for red text.

Keyboard and screen readers

KeysWhat they do
Shift + F10 or Menu Open the menu on the focused item.
Up or Down Move through the actions.
Enter or Space Run the action.
Escape Close it.
  • It is a shortcut: the same actions must also be somewhere visible.