Bootstrap Tooltips
Bootstrap tooltips are small pop-up windows that appear when the user hovers over an element. They are useful for providing additional information or context to the user.
Syntax
To add a tooltip to an element, you need to add the data-toggle
and title
attributes to the element. Here's the syntax:
<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-custom-class="custom-tooltip" data-bs-title="This top tooltip is themed via CSS variables.">
Hover over me
</button>
Make sure to include the following JavaScript code to initialize the tooltip:
<script>
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})
</script>