AI CSS Animations

Someone Is Typing Text

The chat status line with three bouncing dots after a name. The dots use the same bounce curve as Tailwind's animate-bounce, staggered with negative delays so they ripple from the first frame.

Also known as: user is typing animation, typing indicator css, chat typing dots text.

Maya is typing

HTML

<div class="txt-someone-is-typing-text">
  <span>Maya is typing</span>
  <span class="txt-someone-is-typing-text-dots" aria-hidden="true"><i></i><i></i><i></i></span>
</div>

CSS

.txt-someone-is-typing-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  font-size: calc(var(--txt-size, 32px) * 0.75);
  font-weight: 500;
  color: color-mix(in srgb, currentColor 60%, transparent);}
.txt-someone-is-typing-text-dots {
  display: inline-flex;
  gap: 0.18em;
}
.txt-someone-is-typing-text-dots i {
  width: 0.3em;
  height: 0.3em;
  border-radius: 50%;
  background: var(--c);
  animation: txt-someone-is-typing-text-bounce 1s infinite;
}
.txt-someone-is-typing-text-dots i:nth-child(1) { animation-delay: -0.3s; }
.txt-someone-is-typing-text-dots i:nth-child(2) { animation-delay: -0.15s; }
@keyframes txt-someone-is-typing-text-bounce {
  0%, 100% { transform: translateY(-0.3em); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: none; animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-someone-is-typing-text, .txt-someone-is-typing-text *, .txt-someone-is-typing-text::before, .txt-someone-is-typing-text::after, .txt-someone-is-typing-text *::before, .txt-someone-is-typing-text *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Tailwind CSS version

The same effect using Tailwind utility classes. No custom CSS or config needed.

<div class="inline-flex items-baseline gap-2 text-2xl font-medium text-gray-500">
  <span>Maya is typing</span>
  <span class="inline-flex gap-1" aria-hidden="true">
    <span class="flex h-4 items-end animate-bounce [animation-delay:-0.3s]"><span class="h-1.5 w-1.5 rounded-full bg-blue-500"></span></span>
    <span class="flex h-4 items-end animate-bounce [animation-delay:-0.15s]"><span class="h-1.5 w-1.5 rounded-full bg-blue-500"></span></span>
    <span class="flex h-4 items-end animate-bounce"><span class="h-1.5 w-1.5 rounded-full bg-blue-500"></span></span>
  </span>
</div>

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • 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 text animations