HTML popover Global Attribute
The popover attribute turns an element into a popover, hidden until it is opened and then shown above the rest of the page in the top layer.
Description
The popover attribute is a global attribute that turns any element into a popover: content that is hidden by default and, when shown, is displayed in the top layer, above all other content, without any z-index or positioning tricks. It is used for menus, tooltips, pickers, toast notifications and other floating UI.
A popover element is hidden until it is opened. It can be opened and closed without JavaScript by a button that points to its id with the popovertarget attribute (or commandfor with command="toggle-popover"), or with the JavaScript methods showPopover(), hidePopover() and togglePopover().
Example
<button popovertarget="info">More info</button>
<div id="info" popover>
<h3>Product details</h3>
<p>This product is made from eco-friendly materials.</p>
</div>
Behavior
popoverorpopover="auto": the popover can be light dismissed by clicking outside it or pressing Esc, and opening it closes other auto popovers that are not its ancestors.popover="manual": the popover is only closed explicitly, by a button or JavaScript, and several can be open at once.popover="hint": for tooltips. It is light dismissed likeauto, but opening it does not close openautopopovers; it only closes other hints.- The browser fires the
beforetoggleandtoggleevents when the popover opens or closes, and the:popover-openpseudo-class matches it while it is shown. - By default, popovers are centered in the viewport. Use CSS anchor positioning to place a popover next to the button that opens it.
Key Notes
- When opened by a
popovertargetbutton, the browser connects the two for accessibility and returns focus to the button when the popover is light dismissed. - A popover is not modal: the rest of the page stays interactive. Use a
<dialog>opened withshowModal()when the user must respond before continuing.
Syntax
<div id="my-popover" popover="auto | manual | hint"></div>
Values
- autoThe default, also used when the attribute has no value. The popover can be light dismissed, and opening it closes other auto popovers.
- manualThe popover must be closed explicitly with a button or JavaScript. It does not close other popovers.
- hintFor tooltips: light dismissed, and does not close open auto popovers. Supported in Chrome and Edge 151, Firefox 153 and Opera 135, but not yet in Safari.
Example
Browser Support
The following information will show you the current browser support for the HTML popover global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
Desktop





Tablets & Mobile





