Bootstrap Popovers - Popovers in bootstrap with examples
Bootstrap Popovers
- The Popover component is similar to tooltips it is a pop-up box that appears when the user clicks on an element.
- The difference is that the popover can contain much more content.
- Titles are set via data-bs-title and body content is set via data-bs-content.
- Popovers rely on the 3rd party library Popper.js for positioning. You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js in order for popovers to work.
Sample Code
Output
Bootstrap Popovers Four Directions
- Four options are available(top, right, bottom, and left).
Sample Code
Output
Bootstrap Custom Popovers
- We set a custom class with data-bs-custom-class="custom-popover" to scope our custom appearance and use it to override some of the local CSS variables.
Sample Code
Output
Bootstrap Popovers 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.
Sample Code
Output
Bootstrap Popovers Disabled Elements
- Elements disabled attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover.
- As a workaround, you’ll want to trigger the popover from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0".