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

Chapter 03 Actions

Menu

A short list of actions that opens from a button, such as the actions on a row. Enter, Space or the down arrow open it, the arrow keys and typing move through it, and Escape closes it and puts focus back on the button. For choosing a value, use a select.

Use it in Angular
import { MenuComponent, MenuItemComponent, MenuTriggerDirective } from '@okaapi-ui/angular';
// On the Angular CDK menu. Add @angular/cdk/overlay-prebuilt.css.

Row actions

Angular
<button ui-button variant="secondary" [uiMenuTrigger]="actions">Actions</button>
<ng-template #actions>
  <ui-menu>
    <button ui-menu-item (triggered)="edit()">Edit</button>
    <button ui-menu-item (triggered)="duplicate()">Duplicate</button>
    <button ui-menu-item disabled>Archive</button>
    <div class="ui-menu__separator" role="separator"></div>
    <button ui-menu-item danger (triggered)="remove()">Delete</button>
  </ui-menu>
</ng-template>

In Arabic

Angular
<button ui-button variant="secondary" [uiMenuTrigger]="menu">إجراءات</button>
<ng-template #menu>
  <ui-menu>
    <button ui-menu-item>تعديل</button>
    <button ui-menu-item danger>حذف</button>
  </ui-menu>
</ng-template>

When to use something else

If you needUse
The same actions on right-click or a long pressContext menu
Pick a value that a form sendsSelect
Links that go to other pagesNavigation
Two or three actions that fit on screenButton group

Inputs

NameTypeDefaultWhat it does
[uiMenuTrigger]TemplateRef — On the button; the template holding the ui-menu.
ui-menucomponent — The list, inside that template.
button[ui-menu-item]component — One action.
(triggered)void — The action was chosen by click, Enter or Space.
dangerbooleanfalseRed text, for an action that destroys something.
disabledbooleanfalseShown, but cannot be chosen.

Keyboard and screen readers

KeysWhat they do
Enter or Space or Down Open the menu from its button.
Up or Down Move through the actions.
Letters Jump to the action that starts with them.
Enter or Space Run the action.
Escape Close it, and put focus back on the button.
  • Read as a menu of items; the button says it opens a menu.