popover.mdx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ---
  2. title: Popovers
  3. summary: Popovers are used to provide additional information on elements where a simple tooltip is not sufficient.
  4. bootstrapLink: components/popovers
  5. description: Provide extra information with popovers.
  6. ---
  7. ## Default markup
  8. To create a default popover use:
  9. ```html example centered
  10. <button type="button" class="btn" 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>
  11. ```
  12. ## Four directions
  13. Four options are available: `top`, `right`, `bottom`, and `left` aligned. Directions are mirrored when using Bootstrap in RTL.
  14. ```html example centered separated
  15. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="top" data-bs-content="Top popover">Popover on top</button>
  16. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right" data-bs-content="Right popover">Popover on right</button>
  17. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">Popover on bottom</button>
  18. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Left popover">Popover on left</button>
  19. ```
  20. ```html
  21. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="top" data-bs-content="Top popover">
  22. Popover on top
  23. </button>
  24. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right" data-bs-content="Right popover">
  25. Popover on right
  26. </button>
  27. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">
  28. Popover on bottom
  29. </button>
  30. <button type="button" class="btn" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Left popover">
  31. Popover on left
  32. </button>
  33. ```
  34. ## Popover on hover
  35. Popover can be triggered `manual`, with a `click` and on `focus` and on `hover`. This one reacts on hover.
  36. ```html example centered
  37. <button type="button" class="btn btn-primary" data-bs-trigger="hover" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Hover to toggle popover</button>
  38. ```
  39. ```html
  40. <button type="button" class="btn btn-primary" data-bs-trigger="hover" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">
  41. Hover to toggle popover
  42. </button>
  43. ```