tooltips.mdx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. ---
  2. title: Tooltips
  3. summary: 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. description: Guide users with informative tooltips.
  6. ---
  7. ## Default markup
  8. 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.
  9. ```html example centered separated
  10. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip on top">
  11. Tooltip on top
  12. </button>
  13. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="right" title="Tooltip on right">
  14. Tooltip on right
  15. </button>
  16. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Tooltip on bottom">
  17. Tooltip on bottom
  18. </button>
  19. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-placement="left" title="Tooltip on left">
  20. Tooltip on left
  21. </button>
  22. ```
  23. ## Tooltip with HTML
  24. 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.
  25. ```html example height="7rem"
  26. <button type="button" class="btn" data-bs-toggle="tooltip" data-bs-html="true" title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
  27. Tooltip with HTML
  28. </button>
  29. ```