AI CSS Animations

Typing Indicator

The chat-app 'someone is typing' bubble: three small dots lifting in turn inside a rounded pill. Use it for streaming AI responses and message threads.

Also known as: chat typing bubble, someone is typing animation.

HTML

<div class="ldr-typing-dots" role="status" aria-label="Typing">
  <span></span><span></span><span></span>
</div>

CSS

.ldr-typing-dots {
  --s: var(--ldr-size, 48px);
  --c: var(--ldr-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  gap: calc(var(--s) / 10);
  padding: calc(var(--s) / 5) calc(var(--s) / 3.5);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ldr-color, #3b82f6) 12%, transparent);
}
.ldr-typing-dots span {
  width: calc(var(--s) / 6);
  height: calc(var(--s) / 6);
  border-radius: 50%;
  background: var(--c);
  animation: ldr-typing-dots-lift 1.2s ease-in-out infinite;
}
.ldr-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.ldr-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ldr-typing-dots-lift {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(calc(var(--s) / -8)); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ldr-typing-dots, .ldr-typing-dots *, .ldr-typing-dots::before, .ldr-typing-dots::after {
    animation-duration: 3s;
  }
}

Tailwind CSS version

The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.

<div class="inline-flex items-center gap-1 rounded-full bg-blue-500/10 px-3 py-2" role="status" aria-label="Typing">
  <span class="h-2 w-2 animate-bounce rounded-full bg-blue-500"></span>
  <span class="h-2 w-2 animate-bounce rounded-full bg-blue-500 [animation-delay:0.15s]"></span>
  <span class="h-2 w-2 animate-bounce rounded-full bg-blue-500 [animation-delay:0.3s]"></span>
</div>

Customizing this loader

  • Color: set --ldr-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --ldr-size. Every dimension in the snippet is derived from it. Currently previewing 64px.
  • Speed: change the duration on the animation shorthand. Delays on the children are relative, so they keep their rhythm.
  • Accessibility: the root carries role="status" and an aria-label so screen readers announce the wait. The reduced-motion rule at the end slows the animation for users who asked for less motion.

Similar loaders