Popovers
Things to know when using the popover plugin:
- Popovers rely on the 3rd party library Popper for positioning. You must include popper.min.js before bootstrap.js or use
bootstrap.bundle.min.js
/bootstrap.bundle.js
which contains Popper in order for popovers to work! - Popovers require the tooltip plugin as a dependency.
- Popovers are opt-in for performance reasons, so you must initialize them yourself.
- Zero-length
title
andcontent
values will never show a popover. - Specify
container: 'body'
to avoid rendering problems in more complex components (like our input groups, button groups, etc). - Triggering popovers on hidden elements will not work.
- Popovers for
.disabled
ordisabled
elements must be triggered on a wrapper element. - When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors' overall width. Use
.text-nowrap
on your<a>
s to avoid this behavior. - Popovers must be hidden before their corresponding elements have been removed from the DOM.
- Popovers can be triggered thanks to an element inside a shadow DOM.
<button type="button" class="btn btn-lg btn-danger" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
Basic Example
Four directions
Four options are available: top, right, bottom, and left aligned. Directions are mirrored when using Bootstrap in RTL.
Dismiss on next click
Use the focus
trigger to dismiss popovers on the user’s next click of a different element than the toggle element.