Tooltip Component
A CSS implementation of the Sprout tooltip component.
Related
Sprout Tooltip documentation [external]
Example
html
<div>
<div class="spr-tooltip"> I am a tooltip text. </div>
</div>
Example
html
<div class="spr-tooltip-bubble">
<div class="close-button">
<i class="spr-icon spr-icon-close"></i>
</div>
<div class="spr-tooltip-bubble-title">
Tooltip title
</div>
<div class="spr-tooltip-bubble-text">
Here comes the more detailed message.
</div>
</div>
Compiled CSS
Example
scss
@import 'components/tooltip';
css
compiled
@keyframes openPopover {
from {
transform: scale(0.9);
}
to {
transform: scale(1);
}
}
.spr-tooltip {
color: #056ad7;
text-decoration-line: underline;
text-decoration-style: dotted;
cursor: pointer;
}
.spr-tooltip-backdrop {
background-color: rgba(24, 25, 27, 0.5);
}
.spr-tooltip-bubble {
font-family: "AvenirNext", "Helvetica Neue", Arial, sans-serif;
font-size: 0.875rem;
line-height: 1.25rem;
letter-spacing: 0;
font-weight: 400;
display: block;
position: relative;
box-sizing: border-box;
background-color: #18191b;
border-radius: 0.25rem;
color: #fff;
padding: 1rem;
max-width: 20rem;
}
.spr-tooltip-bubble.spr-tooltip-bubble-mobile {
width: 100vw;
max-width: 25rem;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.spr-tooltip-bubble.spr-tooltip-bubble-top {
margin-bottom: 0.5rem;
}
.spr-tooltip-bubble.spr-tooltip-bubble-bottom, .spr-tooltip-bubble.spr-tooltip-bubble-field {
margin-top: 0.5rem;
}
.spr-tooltip-bubble.spr-tooltip-bubble-left {
margin-right: 0.5rem;
}
.spr-tooltip-bubble.spr-tooltip-bubble-right {
margin-left: 0.5rem;
}
.spr-tooltip-bubble .spr-tooltip-bubble-actions {
cursor: pointer;
user-select: none;
font-family: "AvenirNext", "Helvetica Neue", Arial, sans-serif;
font-size: 1.25rem;
line-height: 1.75rem;
letter-spacing: 0;
font-weight: 600;
position: absolute;
right: 1rem;
top: 0rem;
padding-top: 1rem;
line-height: 0;
pointer-events: all;
}
.spr-tooltip-bubble .spr-tooltip-bubble-actions .spr-icon-close {
color: #fff;
}
.spr-tooltip-bubble .spr-tooltip-bubble-title {
display: block;
font-weight: 600;
margin-bottom: 0.75rem;
}
.spr-tooltip-bubble.spr-tooltip-bubble-no-title .spr-tooltip-bubble-text {
margin-right: 2rem;
}