popover
Turns an element into a popover.
Published on • Updated on
The popover
property of the HTMLElement
interface turns an element into a popover. It is the DOM definition of the HTML popover
attribute.
Value
A string that can take one of the following values:
auto
- The popover exhibits the standard behavior explained at The Popover API: concepts and usage.
manual
- Manual popovers cannot be light dismissed, they can only be dismissed by an explicit trigger element (created for example using
popovertoggletarget
) or by JavaScript (usinghidePopover()
), and they don't automatically dismiss previously-shown popovers.
Example
const popover = document.getElementById('my-popover');
// get
popover.popover;
// set
popover.popover = 'manual';
Browser compatibility
- The Popover API is planned for launch in Chrome 110, available in stable in early February 2023 (check the Chrome Roadmap for updates).
- It is enabled by default in Chrome Canary for local testing.
- Register for the Origin Trial if you want to test it in a production environment. Read Getting started with Chrome's origin trials for more information.
- There is a polyfill available at https://github.com/oddbird/popup-polyfill.
See also
Updated on • Improve article