Skip to content
On this page

Popover API

js
const popover = document.querySelector('awc-popover');

Methods

open

Whether the popover is open or not.

js
popover.open;

show

Shows the popover.

js
popover.show();

hide

Hides the popover.

js
popover.hide();

toggle

Shows/hides the popover.

js
popover.toggle();

reposition

Updates the position of the popover element. If you are rendering elements lazily within the popover element, you can call this function to update the popover's placement once the elements have been loaded.

js
await popover.reposition();

Events

NameBubblesDescription
awc-popover:showtrueThis event fires immediately when the open attribute is added.
awc-popover:showntrueThis event fires when the popover has been made visible to the user (will wait for the focus trap to be activated).
awc-popover:hidetrueThis event fires immediately when the open attribute is removed.
awc-popover:hiddentrueThis event fires when the popover has been completely hidden from the user (will wait for the focus trap to be deactivated).

Released under the MIT License.