AI CSS Animations

Deploy Status Border

A deploy card whose dashed border marches while it builds, then closes into a solid green line with a glow as the status flips to Ready. One SVG rect animates dash length, offset and color.

Also known as: status border animation, build status card css, deployment card animation, dashed border loading css.

Production BuildingReady main · 3f9c2e1 · fix: retry webhook

HTML

<div class="bdr-deploy-status-border">
  <svg class="bdr-deploy-status-border-svg" aria-hidden="true">
    <rect class="bdr-deploy-status-border-rect" width="100%" height="100%" pathLength="100"/>
  </svg>
  <span class="bdr-deploy-status-border-row">
    <span class="bdr-deploy-status-border-env">Production</span>
    <span class="bdr-deploy-status-border-pill" role="status"><span>Building</span><span>Ready</span></span>
  </span>
  <span class="bdr-deploy-status-border-meta">main · 3f9c2e1 · fix: retry webhook</span>
</div>

CSS

.bdr-deploy-status-border {
  --c: var(--bdr-color, #3b82f6);
  font-size: var(--bdr-size, 16px);
  position: relative;
  display: grid;
  place-items: center;
  width: 15em;
  height: 8.5em;
  border-radius: 1em;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  --t: 7s;
  --ok: color-mix(in oklch, var(--c), #22c55e 80%);
  box-sizing: border-box;
  place-items: initial;
  align-content: center;
  gap: 0.6em;
  padding: 0 1.3em;
  background: color-mix(in srgb, var(--c) 4%, transparent);
}
.bdr-deploy-status-border-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.bdr-deploy-status-border-rect {
  rx: 1em;
  fill: none;
  stroke-width: 0.13em;
  stroke-linecap: round;
  animation: bdr-deploy-status-border-build var(--t) infinite;
}
.bdr-deploy-status-border-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bdr-deploy-status-border-env { font-size: 1em; }
.bdr-deploy-status-border-pill {
  display: grid;
  font-size: 0.68em;
}
.bdr-deploy-status-border-pill span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.65em;
  border-radius: 1em;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--c);
  animation: bdr-deploy-status-border-building var(--t) infinite;
}
.bdr-deploy-status-border-pill span + span {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  animation-name: bdr-deploy-status-border-ready;
}
.bdr-deploy-status-border-pill span::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
}
.bdr-deploy-status-border-meta {
  font: 500 0.68em/1.3 ui-monospace, Menlo, monospace;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Building: short dashes march. Ready: dashes grow until the gaps close, turn green and glow. */
@keyframes bdr-deploy-status-border-build {
  0%        { stroke: var(--c); stroke-dasharray: 1.2 1.8; stroke-dashoffset: 0; opacity: 0; filter: none; animation-timing-function: ease-out; }
  4%        { stroke: var(--c); stroke-dasharray: 1.2 1.8; stroke-dashoffset: -1.2; opacity: 1; filter: none; animation-timing-function: linear; }
  58%       { stroke: var(--c); stroke-dasharray: 1.2 1.8; stroke-dashoffset: -18; opacity: 1; filter: none; animation-timing-function: cubic-bezier(0.6, 0, 0.3, 1); }
  66%       { stroke: var(--ok); stroke-dasharray: 3 0; stroke-dashoffset: -21; opacity: 1; filter: drop-shadow(0 0 0.35em var(--ok)); animation-timing-function: ease-out; }
  80%       { stroke: var(--ok); stroke-dasharray: 3 0; stroke-dashoffset: -21; opacity: 1; filter: none; }
  94%, 100% { stroke: var(--ok); stroke-dasharray: 3 0; stroke-dashoffset: -21; opacity: 0; filter: none; }
}
@keyframes bdr-deploy-status-border-building {
  0%, 60%   { opacity: 1; transform: none; }
  64%, 100% { opacity: 0; transform: translateY(-0.4em); }
}
@keyframes bdr-deploy-status-border-ready {
  0%, 60%   { opacity: 0; transform: translateY(0.4em) scale(0.9); }
  65%       { opacity: 1; transform: none; }
  92%       { opacity: 1; transform: none; }
  97%, 100% { opacity: 0; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bdr-deploy-status-border-rect { animation: none; stroke: var(--c); stroke-dasharray: 1.2 1.8; }
  .bdr-deploy-status-border-pill span { animation: none; }
  .bdr-deploy-status-border-pill span + span { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .bdr-deploy-status-border, .bdr-deploy-status-border *, .bdr-deploy-status-border::before, .bdr-deploy-status-border::after, .bdr-deploy-status-border *::before, .bdr-deploy-status-border *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --bdr-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --bdr-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar border animations