AI CSS Animations

Emoji Reaction Tooltip

Hover a reaction chip to see who reacted: the emoji pops out large with a wiggle above the names. The chip's own emoji hops at the same moment, so the two read as one gesture.

Also known as: who reacted tooltip, slack reaction tooltip css, reaction count hover.

Maya, Leo and 10 others reacted with :tada:

HTML

<span class="tip-emoji-reaction">
  <button type="button" aria-label="Party popper, 12 reactions" aria-describedby="tip-emoji-reaction-tip"><span class="tip-emoji-reaction-small" aria-hidden="true">🎉</span>12</button>
  <span class="tip-emoji-reaction-tip" id="tip-emoji-reaction-tip" role="tooltip"><span class="tip-emoji-reaction-big" aria-hidden="true">🎉</span>Maya, Leo and 10 others reacted with :tada:</span>
</span>

CSS

.tip-emoji-reaction {
  --c: var(--tip-color, #3b82f6);
  font-size: var(--tip-size, 16px);
  position: relative;
  display: inline-flex;
  margin-top: 6.5em; /* room for the tooltip in this preview */
}
.tip-emoji-reaction button {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.3em 0.7em 0.3em 0.55em;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-radius: 2em;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--c);
  font: 700 0.9em/1.4 system-ui, sans-serif;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.tip-emoji-reaction:hover button { background: color-mix(in srgb, var(--c) 22%, transparent); }
.tip-emoji-reaction button:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 2px;
}
.tip-emoji-reaction-small {
  display: inline-block;
  font-size: 1.15em;
}
.tip-emoji-reaction:hover .tip-emoji-reaction-small,
.tip-emoji-reaction:focus-within .tip-emoji-reaction-small {
  animation: tip-emoji-reaction-hop 0.5s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.tip-emoji-reaction-tip {
  position: absolute;
  bottom: calc(100% + 0.7em);
  left: 50%;
  z-index: 10;
  box-sizing: border-box;
  width: 14.5em;
  padding: 0.7em 1em 0.8em;
  border-radius: 0.7em;
  background: color-mix(in srgb, var(--c) 14%, #0f172a);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.07), 0 0.6em 1.2em -0.5em rgb(0 0 0 / 0.5);
  color: rgb(255 255 255 / 0.85);
  font: 500 0.8em/1.4 system-ui, sans-serif;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: 50% 100%;
  transform: translate(-50%, 0.4em) scale(0.92);
  transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.3s;
}
.tip-emoji-reaction-tip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0.65em;
  height: 0.65em;
  background: inherit;
  transform: translate(-50%, -50%) rotate(45deg);
}
.tip-emoji-reaction-big {
  display: block;
  width: 1.5em;
  margin: 0 auto 0.2em;
  font-size: 1.9em;
  line-height: 1.3;
}
.tip-emoji-reaction:hover .tip-emoji-reaction-tip,
.tip-emoji-reaction:focus-within .tip-emoji-reaction-tip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}
.tip-emoji-reaction:hover .tip-emoji-reaction-big,
.tip-emoji-reaction:focus-within .tip-emoji-reaction-big {
  animation: tip-emoji-reaction-pop 0.7s cubic-bezier(0.3, 0.7, 0.4, 1) 0.08s both;
}
@keyframes tip-emoji-reaction-pop {
  0% { opacity: 0; transform: scale(0.3) rotate(-25deg); }
  45% { opacity: 1; transform: scale(1.2) rotate(12deg); }
  65% { transform: scale(0.95) rotate(-6deg); }
  82% { transform: scale(1.03) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes tip-emoji-reaction-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-0.35em) scale(1.15) rotate(-10deg); }
  65% { transform: translateY(0.05em) scale(0.95, 1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .tip-emoji-reaction, .tip-emoji-reaction *, .tip-emoji-reaction::before, .tip-emoji-reaction::after, .tip-emoji-reaction *::before, .tip-emoji-reaction *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --tip-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --tip-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar tooltips