Popover

Popover is a container component that can overlay other components on page.

import { PopoverModule } from 'primeng/popover';

Popover is accessed via its reference and visibility is controlled using toggle, show and hide methods with an event of the target.

In this sample, data is retrieved from the content inside the popover.

Place the Popover outside of the data iteration components to avoid rendering it multiple times.

IdCodeNamePriceImageDetails
1000f230fh0g3Bamboo Watch$ 65bamboo-watch.jpg
1001nvklal433Black Watch$ 72black-watch.jpg
1002zz21cz3c1Blue Band$ 79blue-band.jpg
1003244wgerg2Blue T-Shirt$ 29blue-t-shirt.jpg
1004h456wer53Bracelet$ 15bracelet.jpg

Content of the OverlayPanel is defined by content template.

show method takes two parameters, first one is the event and it is mandatory. By default the target component to align the overlay is the event target, if you'd like to align it to another element, provide it as the second parameter target.

Target Element

Screen Reader

Popover component uses dialog role and since any attribute is passed to the root element you may define attributes like aria-label or aria-labelledby to describe the popup contents. In addition aria-modal is added since focus is kept within the popup.

It is recommended to use a trigger component that can be accessed with keyboard such as a button, if not adding tabIndex would be necessary. Popover adds aria-expanded state attribute and aria-controls to the trigger so that the relation between the trigger and the popup is defined.

Popover Keyboard Support

When the popup gets opened, the first focusable element receives the focus and this can be customized by adding autofocus to an element within the popup.

KeyFunction
tabMoves focus to the next the focusable element within the popup.
shift + tabMoves focus to the previous the focusable element within the popup.
escapeCloses the popup and moves focus to the trigger.

Close Button Keyboard Support

KeyFunction
enterCloses the popup and moves focus to the trigger.
spaceCloses the popup and moves focus to the trigger.
Figma UI Kit
The official Figma UI Kit for Prime UI libraries, the essential resource for designing with PrimeOne components.