Nearby lessons

25 of 39

πŸ’‘ BS5 Tooltip

πŸ“Œ What Are Bootstrap 5 Tooltips?

Tooltips show short text on hover or focus. Add data-bs-toggle="tooltip" and title="Your text" to the element. Tooltips require JavaScript: create each with new bootstrap.Tooltip(element) (e.g. for all [data-bs-toggle="tooltip"]).

πŸ’‘ Enabling Tooltips (data-bs-toggle, title)

data-bs-toggle="tooltip" – enables the component. title – text shown in the tooltip. You must initialize tooltips with JavaScript; they do not work with CSS only.

πŸ…±οΈ

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 β€’ Enterprise Ready

πŸ“ Placement (data-bs-placement)

data-bs-placement – where the tooltip appears: top, right, bottom, left, or auto.

πŸ…±οΈ

bootstrap Designer

Live Component Playground

html Source
Loading...
Built with Bootstrap 5.3 β€’ Enterprise Ready

βœ… Tooltip Best Practices

  • Initialize with JavaScript: new bootstrap.Tooltip(element) for each trigger.
  • Use title for the tooltip content.
  • Use data-bs-placement to avoid tooltips going off-screen.

🧠 Test Your Knowledge

3 Questions

Progress: 0 / 3
Keep Going!BS5 Popover