A thin track with a bar that slides across it endlessly. Use it when you have no idea how long the wait is, at the top of a page or under a form.
Also known as: loading bar, linear progress indicator.
<div class="ldr-progress-bar" role="progressbar" aria-label="Loading"></div>
.ldr-progress-bar {
--s: var(--ldr-size, 48px);
--c: var(--ldr-color, #3b82f6);
position: relative;
width: calc(var(--s) * 5);
height: calc(var(--s) / 8);
border-radius: 999px;
background: color-mix(in srgb, var(--ldr-color, #3b82f6) 15%, transparent);
overflow: hidden;
}
.ldr-progress-bar::before {
content: "";
position: absolute;
inset: 0;
width: 40%;
border-radius: inherit;
background: var(--c);
animation: ldr-progress-bar-slide 1.2s ease-in-out infinite;
}
@keyframes ldr-progress-bar-slide {
from { transform: translateX(-100%); }
to { transform: translateX(250%); }
}
@media (prefers-reduced-motion: reduce) {
.ldr-progress-bar, .ldr-progress-bar *, .ldr-progress-bar::before, .ldr-progress-bar::after {
animation-duration: 3s;
}
}--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.