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

Chapter 06 Overlays

Popover

A small panel next to its button, for a few details or a couple of settings. It is not modal: focus moves into it, and Escape or a click outside closes it and puts focus back on the button. Screen readers name it after the button. For a task that needs the reader's full attention, use a dialog.

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

Details

Angular
<button ui-button variant="secondary" [uiPopoverTrigger]="fee">Delivery fee</button>
<ng-template #fee>
  <p class="ui-popover__title">EGP 45 in Cairo and Giza</p>
  <p>Free on orders over EGP 500.</p>
</ng-template>

A few settings

Angular
<button ui-button variant="secondary" [uiPopoverTrigger]="view">View options</button>
<ng-template #view>
  <ui-switch label="Show paid orders" formControlName="paid" />
  <ui-switch label="Compact rows" formControlName="compact" />
</ng-template>

When to use something else

If you needUse
A short label for an icon buttonTooltip
A list of actionsMenu
A task that needs the reader’s full attentionDialog

Inputs

NameTypeDefaultWhat it does
[uiPopoverTrigger]TemplateRef — Required, on the button: the content to show.

Keyboard and screen readers

KeysWhat they do
Enter or Space Open it from its button; focus moves in.
Escape Close it, and put focus back on the button.
  • Named after its button. It is not modal, so the page stays reachable.