A tinted label that slides out to the left of a round action button while the plus icon turns. The arrow is the classic CSS border triangle, colored to match the label.
Also known as: tooltip on the left css, floating action button tooltip, fab label on hover.
<span class="tip-left-arrow"> <button type="button" aria-label="New document" aria-describedby="tip-left-arrow-tip"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button> <span class="tip-left-arrow-tip" id="tip-left-arrow-tip" role="tooltip">Start from a blank page</span> </span>
.tip-left-arrow {
--c: var(--tip-color, #3b82f6);
font-size: var(--tip-size, 16px);
position: relative;
display: inline-flex;
margin-left: 10em; /* room for the tooltip in this preview */
}
.tip-left-arrow button {
display: grid;
place-items: center;
width: 3em;
height: 3em;
padding: 0;
border: 0;
border-radius: 50%;
background: var(--c);
box-shadow: 0 0.4em 1em -0.3em color-mix(in srgb, var(--c) 70%, transparent);
color: #fff;
cursor: pointer;
}
.tip-left-arrow svg {
width: 1.35em;
height: 1.35em;
transition: transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.tip-left-arrow:hover svg,
.tip-left-arrow:focus-within svg { transform: rotate(90deg); }
.tip-left-arrow button:focus-visible {
outline: 2px solid var(--c);
outline-offset: 2px;
}
.tip-left-arrow-tip {
--bg: color-mix(in srgb, var(--c) 22%, #fff);
position: absolute;
top: 50%;
right: calc(100% + 1em);
z-index: 10;
padding: 0.5em 0.8em;
border-radius: 0.45em;
background: var(--bg);
box-shadow: 0 0.4em 1em -0.4em rgb(15 23 42 / 0.35);
color: color-mix(in srgb, var(--c) 55%, #000);
font: 600 0.85em/1.3 system-ui, sans-serif;
white-space: nowrap;
opacity: 0;
visibility: hidden;
pointer-events: none;
transform: translate(0.8em, -50%);
transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.35s;
}
/* a border triangle: three transparent sides and one colored */
.tip-left-arrow-tip::after {
content: "";
position: absolute;
top: 50%;
left: 100%;
border: 0.45em solid transparent;
border-right: 0;
border-left-color: var(--bg);
transform: translateY(-50%);
}
.tip-left-arrow:hover .tip-left-arrow-tip,
.tip-left-arrow:focus-within .tip-left-arrow-tip {
opacity: 1;
visibility: visible;
transform: translate(0, -50%);
}
@media (prefers-reduced-motion: reduce) {
.tip-left-arrow, .tip-left-arrow *, .tip-left-arrow::before, .tip-left-arrow::after, .tip-left-arrow *::before, .tip-left-arrow *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--tip-color on the element or a parent.
Currently previewing #3b82f6.--tip-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.