VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-popover-component-on-hover/

⇱ Bootstrap 5 Popover Component on Hover - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Popover Component on Hover

Last Updated : 23 Jul, 2025

The Bootstrap 5 Popover component allows for the creation of interactive hover-triggered tooltips that display additional content when hovering over an element. This feature enhances user experience by providing contextually relevant information without cluttering the interface, making it ideal for showcasing supplementary details or explanations.

Approach:

  • Structure your HTML with elements that will trigger the popovers.
  • Include the Bootstrap 5 CDN link in HTML file.
  • Add necessary data attributes to the popover trigger elements (data-bs-toggle="popover", data-bs-trigger="hover", data-bs-placement, title, and data-bs-content).
  • Customize popover styling using custom CSS classes if needed.
  • Initialize the popovers in your JavaScript code by selecting the trigger elements and creating Popover instances for each.

Popover from Top and Bottom

To display a popover from the top, set data-bs-trigger="hover" and data-bs-placement="top" attributes. Use the data-bs-content for the popover message. And to display a popover from the bottom, use the same approach as above but with data-bs-placement="bottom".

Example: Implementation to showcase popover from top and bottom.

Output:

Popover from Left and Right

To display a popover from the left, set data-bs-trigger="hover" and data-bs-placement="left" attributes. Utilize the data-bs-content attribute for the popover message. Similarly, to display a popover from the right, use the same approach as above but with data-bs-placement="right".

Example: Implementation to showcase popover from left and right.

Output:

Comment

Explore