popover.mdx 2.6 KB

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