tooltips.mdx 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. ---
  2. title: Tooltips
  3. description: Tooltips are text labels which appear when a user hovers over an interface element. They explain the interface elements that may be unclear for users and guide them when they need help. If used properly, tooltips can significantly enhance user experience and add value to your website or software.
  4. bootstrapLink: components/tooltips/
  5. ---
  6. ## Default markup
  7. Use the default markup to create tooltips that will help users understand particular elements of your interface. You can decide where the text label is to be displayed - at the top, bottom or on either side of the element.
  8. ```html code example centered separated
  9. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">
  10. Tooltip on top
  11. </button>
  12. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="right" title="Tooltip on right">
  13. Tooltip on right
  14. </button>
  15. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tooltip on bottom">
  16. Tooltip on bottom
  17. </button>
  18. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="left" title="Tooltip on left">
  19. Tooltip on left
  20. </button>
  21. ```
  22. ## Tooltip with HTML
  23. If the default tooltip is not enough, you can add the option to use HTML code in the text to highlight particular bits of information and make the content more attractive.
  24. ```html code example height="7rem"
  25. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
  26. Tooltip with HTML
  27. </button>
  28. ```