Build an AI Thinking Loader with CSS

A thinking loader for an AI chat: three dots, a sparkle, and motion that stays on transform and opacity.


Build an AI Thinking Loader with CSS


A thinking state has to read as “still working” without looking like a broken spinner. This loader is two parts: three dots, and a four-point sparkle. The full set of product states is in AI interface animations. More loaders are in AI loading animations.

Markup

<div class="think" role="status" aria-label="Thinking">
  <svg class="think-spark" viewBox="0 0 24 24" aria-hidden="true">
    <path fill="currentColor" d="M12 1.2C12 7.2 7.2 12 1.2 12 7.2 12 12 16.8 12 22.8 12 16.8 16.8 12 22.8 12 16.8 12 12 7.2 12 1.2Z" />
  </svg>
  <span class="think-dots" aria-hidden="true"><i></i><i></i><i></i></span>
</div>

role="status" lets assistive tech announce the label once. The dots are hidden from the accessibility tree so they are not read as empty text.

Motion

Only transform and opacity animate. The sparkle turns a quarter turn and settles. The dots move up in sequence.

.think {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5f6368;
  font: 500 0.95rem/1 Inter, system-ui, sans-serif;
}
.think-spark {
  width: 18px;
  height: 18px;
  color: #1a73e8;
  animation: think-spin 2.8s ease-in-out infinite;
}
.think-dots { display: inline-flex; gap: 4px; }
.think-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: think-hop 1.2s ease-in-out infinite;
}
.think-dots i:nth-child(2) { animation-delay: 0.15s; }
.think-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes think-spin {
  50% { transform: rotate(90deg) scale(1.08); }
}
@keyframes think-hop {
  50% { transform: translateY(-4px); opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .think-spark, .think-dots i { animation: none; }
}

Where to use it

Put it in the assistant row while the request is in flight. Remove it when the first token arrives, then switch to the streaming caret in the AI interface collection. Leaving both on screen reads as two different states at once.