Popovers
Simple Popover
Popover is a component which displays a box with a content after a click on an element - similar to the tooltip but can contain more content.
<button type="button" class="btn btn-danger" data-toggle="popover" title="Popover title" data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
Dismiss on Next Click
Use the focus
trigger to dismiss popovers on the user’s next click of a different element than the toggle element.
<button type="button" tabindex="0" class="btn btn-success" data-toggle="popover" data-trigger="focus" title="" data-content="And here's some amazing content. It's very engaging. Right?" data-original-title="Dismissible popover">
Dismissible popover
</button>
Hover
Use the attribute data-trigger="hover"
to show the popover on hovering the element.
<button type="button" tabindex="0" class="btn btn-dark" data-toggle="popover" data-trigger="hover" title="" data-content="And here's some amazing content. It's very engaging. Right?" data-original-title="Ohh Wow !">
Please Hover Me
</button>
Four Directions
Four options are available: top, right, bottom, and left aligned.
<!-- Top Position -->
<button type="button" class="btn btn-primary" data-container="body" title="" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." data-original-title="">
Popover on top
</button>
<!-- Bottom Position -->
<button type="button" class="btn btn-primary" data-container="body" title="" data-toggle="popover" data-placement="bottom" data-content="Vivamus
sagittis lacus vel augue laoreet rutrum faucibus." data-original-title="">
Popover on bottom
</button>
<!-- Right Position -->
<button type="button" class="btn btn-primary" data-container="body" title="" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." data-original-title="">
Popover on right
</button>
<!-- Left Position -->
<button type="button" class="btn btn-primary" data-container="body" title="" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." data-original-title="Popover title">
Popover on left
</button>
Disabled Elements
Elements with the disabled
attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you’ll want to trigger the popover from a wrapper <div>
or <span>
and override the pointer-events
on the disabled element.
<span class="d-inline-block" data-toggle="popover" data-content="Disabled popover">
<button class="btn btn-primary" style="pointer-events: none;" type="button" disabled>Disabled button</button>
</span>