A button whose label is swapped for three white dots hopping in turn, the pattern chat and payment forms use while a request is out. Keeps an aria-label so it still has a name.
Also known as: button three dots loading, sending button animation, button dots loader.
<button class="ldr-button-loading-dots" type="button" aria-busy="true" aria-label="Sending"> <span></span><span></span><span></span> </button>
.ldr-button-loading-dots {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
display: inline-flex;
align-items: center;
justify-content: center;
gap: calc(var(--s) / 10);
min-width: calc(var(--s) * 2.6);
height: calc(var(--s) * 0.95);
padding: 0 calc(var(--s) / 2);
border: 0;
border-radius: calc(var(--s) / 6);
background: var(--c);
cursor: progress;
}
.ldr-button-loading-dots span {
width: calc(var(--s) / 7);
height: calc(var(--s) / 7);
border-radius: 50%;
background: #fff;
animation: ldr-button-loading-dots-hop 1s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.ldr-button-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ldr-button-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes ldr-button-loading-dots-hop {
0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
30% { transform: translateY(-70%); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
.ldr-button-loading-dots, .ldr-button-loading-dots *, .ldr-button-loading-dots::before, .ldr-button-loading-dots::after, .ldr-button-loading-dots *::before, .ldr-button-loading-dots *::after {
animation-duration: 3s;
}
}The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.
<button type="button" aria-busy="true" aria-label="Sending" class="inline-flex h-10 min-w-[7rem] items-center justify-center gap-1.5 rounded-md bg-blue-500 px-5"> <span class="h-2 w-2 animate-bounce rounded-full bg-white [animation-delay:-0.3s]"></span> <span class="h-2 w-2 animate-bounce rounded-full bg-white [animation-delay:-0.15s]"></span> <span class="h-2 w-2 animate-bounce rounded-full bg-white"></span> </button>
--ldr-color on the element or a parent.
Currently previewing #3b82f6.--ldr-size. Every dimension in the snippet is
derived from it. Currently previewing 64px.animation shorthand.
Delays on the children are relative, so they keep their rhythm.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.