Skip to content

Indeterminate Bar

Progress · Slide · ui, minimal

Customize

HTML

<div class="utw-loader-indeterminate-bar" role="status">
  <span class="utw-loader-indeterminate-bar__bar"></span>
  <span class="utw-loader-indeterminate-bar__sr">Loading…</span>
</div>

CSS

/* Progress loader (Slide) */
.utw-loader-indeterminate-bar {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 300px;
  max-width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e0e7ff;
  overflow: hidden;
}

.utw-loader-indeterminate-bar *,
.utw-loader-indeterminate-bar *::before,
.utw-loader-indeterminate-bar *::after {
  box-sizing: border-box;
}

.utw-loader-indeterminate-bar__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  border-radius: inherit;
  background: #6366f1;
  animation: utw-loader-indeterminate-bar-slide 1.4s ease-in-out infinite;
}

.utw-loader-indeterminate-bar__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes utw-loader-indeterminate-bar-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

@keyframes utw-loader-indeterminate-bar-calm {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .utw-loader-indeterminate-bar *,
  .utw-loader-indeterminate-bar *::before,
  .utw-loader-indeterminate-bar *::after {
    animation: none !important;
  }
  .utw-loader-indeterminate-bar {
    animation: utw-loader-indeterminate-bar-calm 2s ease-in-out infinite alternate !important;
  }
}

Related loaders