1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-28 15:50:01 +02:00

Convert tooltips to CSS vars

This commit is contained in:
Mark Otto
2021-07-29 09:21:53 +03:00
committed by Mark Otto
parent 6c40476af9
commit fdcbbe3d92
3 changed files with 70 additions and 27 deletions

View File

@@ -50,6 +50,29 @@ Hover over the links below to see tooltips:
</p>
</div>
### Custom tooltips
<small class="d-inline-flex px-2 py-1 font-monospace text-muted border rounded-3">Added in v5.2.0</small>
You can customize the appearance of tooltips using [CSS variables](#variables). We set a custom class with `data-bs-custom-class="custom-tooltip"` to scope our custom appearance and use it to override a local CSS variable.
```scss
.custom-tooltip {
--bs-tooltip-bg: var(--bs-primary);
}
```
{{< example class="tooltip-demo" >}}
<button type="button" class="btn btn-secondary"
data-bs-toggle="tooltip" data-bs-placement="top"
data-bs-custom-class="custom-tooltip"
title="This top tooltip is themed via CSS variables.">
Custom tooltip
</button>
{{< /example >}}
### Directions
Hover over the buttons below to see the four tooltips directions: top, right, bottom, and left. Directions are mirrored when using Bootstrap in RTL.
<div class="bd-example tooltip-demo">