A three by three grid of short dashes, each spinning a full turn in a diagonal wave from the top left corner. Uses the stock spin keyframes with strong easing, so it ports to Tailwind as is.
Also known as: line grid loader, spinning dashes loader.
<div class="ldr-rotating-lines-grid" role="status" aria-label="Loading"> <span style="--d: 0"></span><span style="--d: 1"></span><span style="--d: 2"></span> <span style="--d: 1"></span><span style="--d: 2"></span><span style="--d: 3"></span> <span style="--d: 2"></span><span style="--d: 3"></span><span style="--d: 4"></span> </div>
.ldr-rotating-lines-grid {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
display: grid;
grid-template-columns: repeat(3, 1fr);
place-items: center;
width: var(--s);
height: var(--s);
}
.ldr-rotating-lines-grid span {
width: calc(var(--s) / 4);
height: calc(var(--s) / 14);
border-radius: var(--s);
background: var(--c);
animation: ldr-rotating-lines-grid-turn 1.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
animation-delay: calc(var(--d) * 0.1s - 1.6s);
}
@keyframes ldr-rotating-lines-grid-turn {
to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-rotating-lines-grid, .ldr-rotating-lines-grid *, .ldr-rotating-lines-grid::before, .ldr-rotating-lines-grid::after, .ldr-rotating-lines-grid *::before, .ldr-rotating-lines-grid *::after {
animation-duration: 3s;
}
}The same loader using only Tailwind's built-in animation utilities. No custom keyframes or config needed.
<div class="grid h-12 w-12 grid-cols-3 place-items-center" role="status" aria-label="Loading"> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.6s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.5s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.4s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.5s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.4s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.3s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.4s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.3s]"></span> <span class="h-1 w-3 animate-[spin_1.6s_cubic-bezier(0.65,0,0.35,1)_infinite] rounded-full bg-blue-500 [animation-delay:-1.2s]"></span> </div>
--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.