Back to the library

Shelf sort loader

Variant: Standard

A loader for sorting, reindexing or reordering. Six bars start out of order, rise off the shelf, move into ascending order and turn olive when they land, while the status changes from "Sorting…" to "In order." The bars moving right rise higher than the ones moving left, so the two groups pass at different heights. The bar that is already in place never moves. This is the reference weight: a 1.5px stroke, a light fill and a 9px lift.

loadersortingreorderstate-changeprogress

The source

A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Shelf sort loader — Standard</title>
<style>
:root {
  /* Neutrals — fixed, never remixed. */
  --ivory: #faf9f5;
  --paper: #ffffff;
  --oat: #e3dacc;
  --slate: #141413;

  /* Knobs — the remix API. A knob exists iff declared here and used below. */
  --hue: 38.8;
  --lift: 0;
  --chroma: 1;
  --round: 1; /* include ONLY if at least one border-radius is wrapped below */
  --speed: 1;

  /* Accents — derived from the knobs with the family's offsets baked in,
     so one hue roll moves them together. Defaults reproduce the original hex
     (#d97757 / #b85c3e / #788c5d / #b04a3f). */
  --clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
  --clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
  --olive: oklch(calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3));
  --rust: oklch(calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3));

  /* Clock — every duration in the document runs off --t. */
  --cycle: 3.2s; /* the authored master loop */
  --t: calc(var(--cycle) / var(--speed));

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1); /* include only if used */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1); /* include only if used */

  --_card-w: 300px;
  --_bar-w: clamp(11px, 3.8vw, 16px);
  --_gap: clamp(7px, 2.4vw, 10px);
  --_stage-h: clamp(60px, 19vw, 76px);
  --_lift: 9px;
  --_stroke: 1.5px;
  --_shelf: 2px;
  --_fill-clay: color-mix(in oklch, var(--clay) 28%, var(--paper));
  --_fill-olive: color-mix(in oklch, var(--olive) 28%, var(--paper));
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--ivory);
  color: var(--slate);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

.card {
  box-sizing: border-box;
  width: min(var(--_card-w), 92vw);
  padding: clamp(14px, 4.5vw, 20px);
  background: var(--paper);
  border: 1px solid var(--oat);
  border-radius: calc(14px * var(--round));
}

.head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(12px, 3.6vw, 14px);
  margin-bottom: clamp(10px, 3vw, 14px);
}

.status { display: grid; font-weight: 600; }

.status span {
  grid-area: 1 / 1;
  white-space: nowrap;
  animation: status-a var(--t) var(--ease-out) infinite;
}

.status .done { opacity: 0; animation-name: status-b; }

.count { opacity: 0.6; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--_gap);
  width: max-content;
  height: var(--_stage-h);
  margin: 0 auto;
  /* headroom for the highest lift so nothing clips mid-swap */
  padding: calc(var(--_lift) * 1.8) 10px 0;
  border-bottom: var(--_shelf) solid var(--oat);
}

.bar {
  --_x: calc(var(--_d) * (var(--_bar-w) + var(--_gap)));
  --_y: calc(var(--_lift) * var(--_up) * -1);
  position: relative;
  box-sizing: border-box;
  width: var(--_bar-w);
  height: calc(var(--_h) * 1%);
  background: var(--_fill-clay);
  border: var(--_stroke) solid var(--clay);
  border-radius: calc(2px * var(--round));
  box-shadow: 0 0 0 2px var(--paper);
  opacity: 0;
  animation: sort var(--t) var(--ease-in-out) infinite;
  animation-delay: calc((var(--_i) - 6) * 55ms / var(--speed));
}

.bar::after {
  content: "";
  position: absolute;
  inset: calc(var(--_stroke) * -1);
  background: var(--_fill-olive);
  border: var(--_stroke) solid var(--olive);
  border-radius: inherit;
  opacity: 0;
  animation: settle var(--t) var(--ease-out) infinite;
  animation-delay: calc((var(--_i) - 6) * 55ms / var(--speed));
}

/* Rise, travel, set down: three ease-in-out segments so each bar visibly leaves and rejoins the shelf. */
@keyframes sort {
  0% { opacity: 0; transform: translate(var(--_x), 0); animation-timing-function: var(--ease-out); }
  9% { opacity: 1; transform: translate(var(--_x), 0); }
  18% { opacity: 1; transform: translate(var(--_x), var(--_y)); }
  40% { opacity: 1; transform: translate(0, var(--_y)); }
  50% { opacity: 1; transform: translate(0, 0); }
  88% { opacity: 1; transform: translate(0, 0); animation-timing-function: var(--ease-out); }
  95%, 100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes settle {
  0%, 49% { opacity: 0; }
  57%, 100% { opacity: 1; }
}

@keyframes status-a {
  0%, 50% { opacity: 1; }
  56%, 94% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes status-b {
  0%, 50% { opacity: 0; }
  56%, 90% { opacity: 1; }
  95%, 100% { opacity: 0; }
}

@keyframes sort-calm {
  0% { opacity: 0.4; }
  20%, 85% { opacity: 1; }
  100% { opacity: 0.4; }
}

@media (max-width: 380px) {
  .card { padding: 14px; }
  .head { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .bar {
    animation-name: sort-calm;
    animation-duration: calc(var(--t) * 2);
    animation-delay: calc((var(--_i) - 6) * 110ms / var(--speed));
  }
  .bar::after {
    animation-duration: calc(var(--t) * 2);
    animation-delay: calc((var(--_i) - 6) * 110ms / var(--speed));
  }
  .status span { animation-duration: calc(var(--t) * 2); }
}
</style>
</head>
<body>
  <div class="card" role="img" aria-label="Sorting items">
    <div class="head">
      <span class="status"><span>Sorting…</span><span class="done">In order</span></span>
      <span class="count">412 files</span>
    </div>
    <div class="stage" aria-hidden="true">
      <i class="bar" style="--_i:0; --_h:30; --_d:1; --_up:1"></i>
      <i class="bar" style="--_i:1; --_h:44; --_d:2; --_up:1"></i>
      <i class="bar" style="--_i:2; --_h:58; --_d:3; --_up:1"></i>
      <i class="bar" style="--_i:3; --_h:72; --_d:-3; --_up:1.7; z-index:1"></i>
      <i class="bar" style="--_i:4; --_h:86; --_d:0; --_up:0"></i>
      <i class="bar" style="--_i:5; --_h:100; --_d:-3; --_up:1.7; z-index:1"></i>
    </div>
  </div>
</body>
</html>

The variant family

Same idea, one axis moved. Compare them side by side before you commit.