Craft customizes the Bootstrap Popover
through the SASS variables in src/sass/components/_variables.scss and custom SASS code in src/sass/components/_popovers.scss. Bootstrap Popover are globally initialized by
src/js/components/app.js wrapper script via data attribute data-bs-toggle="popover".
.
Basic
Use data-bs-toggle="popover" HTML attribute to initialize a popover by passing any of available options as explained
in Popover Options.
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-placement="top" title="Popover on top" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on top
</button>
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-placement="right" title="Popover on right" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on right
</button>
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-placement="bottom" title="Popover on bottom" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on bottom
</button>
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-placement="left" title="Popover on left" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on left
</button>
<button type="button" class="btn btn-secondary my-2" data-bs-toggle="popover" data-bs-html="true" title="<span><em>Popover</em> <u>title with</u> <b>HTML</b></span>" data-bs-content="And here's some amazing content. It's very <b class='text-danger'>engaging</b>. Right?">
Popover with HTML
</button>
Inverse
Use data-bs-custom-class="popover-inverse" HTML attribute to initialize a popover with inverse style.
<button type="button" class="btn btn-secondary" data-bs-toggle="popover" data-bs-custom-class="popover-inverse" data-bs-placement="top" title="Popover on top" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on top
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="popover" data-bs-custom-class="popover-inverse" data-bs-placement="right" title="Popover on right" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on right
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="popover" data-bs-custom-class="popover-inverse" data-bs-placement="bottom" title="Popover on bottom" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on bottom
</button>
<button type="button" class="btn btn-secondary" data-bs-toggle="popover" data-bs-custom-class="popover-inverse" data-bs-placement="left" title="Popover on left" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Popover on left
</button>
Delay Options
Use custom data-bs-delay-show and data-bs-delay-hide HTML attributes to initialize a popover with showing and hiding delay(ms).
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-delay-show="1000" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Show delay: 1000ms
</button>
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-delay-hide="1000" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Hide delay: 1000ms
</button>
Dismiss
Use custom data-bs-dismiss="true" HTML attribute to initialize a popover with showing and hiding delay(ms).
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-dismiss="true" title="Dismissable popover" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Dismiss for default mode
</button>
<button type="button" class="btn btn-secondary my-2 me-5" data-bs-toggle="popover" data-bs-dismiss="true" title="Dismissable popover" data-bs-content="And here's some amazing content. It's very engaging. Right?">
Dismiss for dark mode
</button>