Back to the library

Receipt — held for undo, then sent

Variant: Undo window

Undo send, drawn as a state the message is in rather than a toast about it. Pressing send lifts the bubble out of the composer, but held: tinted, with a dashed edge, and a short bar draining beside Undo at one linear rate, because four seconds is four seconds — the timer sits next to the action it gates, never under the words where it would read as a spell-check line. Only the commit fills it solid, so the one look that means "they can see this" is never shown while it can still be taken back. Undo plays sending backwards — the bubble drops into the field it rose from and the words are back in the composer, editable — since an undo that only deleted the bubble would leave the person retyping, and the whole promise of a held send is that changing your mind costs nothing. The second send starts a fresh window rather than inheriting what was left of the first. Rising is 240ms on ease-out, the drop back 200ms, the held-to-solid crossfade 200ms, and the tick draws only after the bubble has committed. Reach for it on messages to groups, emails and anything announced to many people at once, where the regret arrives a second after the click.

statuscontroltransitionindicatorloop

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>Receipt — held for undo, then sent</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;
        --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. */
        --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 — 10s, so 1% is 100ms. Sent at 3%, undone at 23%, edited at
           33%, sent again at 43%; the held window runs out and commits at 83%. */
        --cycle: 10s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

        --_muted: color-mix(in srgb, var(--slate) 54%, transparent);
        --_in: color-mix(in srgb, var(--oat) 45%, var(--paper));
        --_held: color-mix(in srgb, var(--clay) 12%, var(--paper));
        --_drop: 46px;
        --_lag: calc(60ms / var(--speed));
      }

      * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
      }

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

      .card {
        width: min(320px, 90vw);
        background: var(--paper);
        border: 1px solid var(--oat);
        border-radius: calc(14px * var(--round));
        overflow: hidden;
      }

      .head {
        display: flex;
        justify-content: space-between;
        padding: 10px 14px;
        font-size: 11.5px;
        color: var(--_muted);
        border-bottom: 1px solid var(--oat);
      }

      .head b {
        color: var(--slate);
        font-weight: 600;
      }

      .thread {
        display: grid;
        gap: 6px;
        padding: clamp(12px, 4vw, 16px) 14px;
      }

      .in {
        justify-self: start;
        max-width: 80%;
        padding: 7px 11px;
        font-size: 13px;
        line-height: 1.35;
        background: var(--_in);
        border-radius: calc(14px * var(--round));
      }

      .bubble {
        position: relative;
        justify-self: end;
        max-width: 80%;
        margin-top: 4px;
        font-size: 13px;
        line-height: 1.35;
        transform-origin: 100% 100%;
        animation: bubble var(--t) infinite;
      }

      /* Undo plays sending backwards: the bubble drops into the field it rose
         from and the words are back in the composer, editable. Undo that
         merely deleted the bubble would leave the person retyping — the
         whole point of a held send is that taking it back costs nothing. */
      @keyframes bubble {
        0%,
        3% {
          opacity: 0;
          transform: translateY(var(--_drop)) scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        5.4%,
        23% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        25%,
        43% {
          opacity: 0;
          transform: translateY(var(--_drop)) scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        45.4%,
        95% {
          opacity: 1;
          transform: none;
          animation-timing-function: ease;
        }
        96.8%,
        100% {
          opacity: 0;
          transform: none;
        }
      }

      .layer {
        display: grid;
        padding: 7px 11px;
        border-radius: calc(14px * var(--round));
      }

      .layer > span {
        grid-area: 1 / 1;
        white-space: nowrap;
      }

      /* Held is drawn as not-yet-real: a tint and a dashed edge where a sent
         message is solid. Only the commit fills it in, so the one look that
         means "they can see this" is never shown while it can still be taken back. */
      .held {
        color: var(--slate);
        background: var(--_held);
        outline: 1px dashed var(--clay);
        outline-offset: -1px;
        animation: held var(--t) infinite;
      }

      .solid {
        position: absolute;
        inset: 0;
        color: var(--paper);
        background: var(--clay-d);
        opacity: 0;
        animation: solid var(--t) infinite;
      }

      @keyframes held {
        0%,
        83% {
          opacity: 1;
          animation-timing-function: ease;
        }
        85%,
        100% {
          opacity: 0;
        }
      }
      @keyframes solid {
        0%,
        83% {
          opacity: 0;
          animation-timing-function: ease;
        }
        85%,
        100% {
          opacity: 1;
        }
      }

      .v1,
      .v2,
      .c1,
      .c2,
      .ph {
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: ease;
      }

      .held .v1 {
        animation-name: v1;
      }
      .held .v2 {
        opacity: 0;
        animation-name: v2;
      }

      /* The text swaps while the bubble is gone; the bubble carries
         whichever words the composer last sent. */
      @keyframes v1 {
        0%,
        30% {
          opacity: 1;
        }
        31%,
        100% {
          opacity: 0;
        }
      }
      @keyframes v2 {
        0%,
        30% {
          opacity: 0;
        }
        31%,
        100% {
          opacity: 1;
        }
      }

      /* The window drains at one linear rate from full — four seconds is
         four seconds — and a second send starts a fresh window rather than
         inheriting what was left of the first. It sits beside Undo, not
         under the words: the timer belongs to the action it gates. */
      .track {
        position: relative;
        width: 24px;
        height: 2px;
        border-radius: 999px;
        background: var(--oat);
      }

      .drain {
        position: absolute;
        inset: 0;
        border-radius: 999px;
        background: var(--clay);
        transform-origin: 0 50%;
        animation: drain var(--t) linear infinite;
      }

      @keyframes drain {
        0%,
        3% {
          transform: scaleX(1);
        }
        23%,
        42.9% {
          transform: scaleX(0.5);
        }
        43% {
          transform: scaleX(1);
        }
        83%,
        100% {
          transform: scaleX(0);
        }
      }

      .meta {
        justify-self: end;
        display: flex;
        align-items: center;
        gap: 5px;
        height: 14px;
        font-size: 11.5px;
        color: var(--_muted);
        transform-origin: 100% 0;
        animation: meta var(--t) infinite backwards;
        animation-delay: var(--_lag);
      }

      /* The meta line rises a beat behind its bubble, as in the rest of the
         family; on undo it simply goes, since the bubble is the thing leaving. */
      @keyframes meta {
        0%,
        3% {
          opacity: 0;
          transform: translateY(8px) scale(0.97);
          animation-timing-function: var(--ease-out);
        }
        5.4%,
        23% {
          opacity: 1;
          transform: none;
          animation-timing-function: var(--ease-out);
        }
        24.8%,
        43% {
          opacity: 0;
          transform: translateY(8px) scale(0.97);
          animation-timing-function: var(--ease-out);
        }
        45.4%,
        95% {
          opacity: 1;
          transform: none;
          animation-timing-function: ease;
        }
        96.8%,
        100% {
          opacity: 0;
          transform: none;
        }
      }

      .tick {
        width: 12px;
        height: 12px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .tick path {
        stroke-dasharray: 16;
        stroke-dashoffset: 16;
        animation: tick var(--t) infinite;
      }

      @keyframes tick {
        0%,
        85% {
          stroke-dashoffset: 16;
          animation-timing-function: var(--ease-out);
        }
        86.8%,
        100% {
          stroke-dashoffset: 0;
        }
      }

      .label {
        display: grid;
        justify-items: end;
      }

      .label > span {
        grid-area: 1 / 1;
        white-space: nowrap;
        animation-duration: var(--t);
        animation-iteration-count: infinite;
        animation-timing-function: ease;
      }

      .l-held {
        display: flex;
        align-items: center;
        gap: 6px;
        animation-name: l-held;
      }
      .l-sent {
        display: flex;
        align-items: center;
        gap: 5px;
        opacity: 0;
        animation-name: l-sent;
      }

      @keyframes l-held {
        0%,
        83% {
          opacity: 1;
        }
        84%,
        100% {
          opacity: 0;
        }
      }
      @keyframes l-sent {
        0%,
        83% {
          opacity: 0;
        }
        84%,
        100% {
          opacity: 1;
        }
      }

      .undo {
        display: inline-block;
        font-weight: 600;
        color: var(--clay-d);
        animation: undo var(--t) infinite;
      }

      /* 80ms down, 120ms up — the family's one press. */
      @keyframes undo {
        0%,
        22.2% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        23% {
          transform: scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        24.2%,
        100% {
          transform: scale(1);
        }
      }

      .composer {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
        border-top: 1px solid var(--oat);
      }

      .field {
        display: grid;
        align-items: center;
        flex: 1;
        min-width: 0;
        height: 32px;
        padding: 0 12px;
        font-size: 13px;
        background: var(--ivory);
        border: 1px solid var(--oat);
        border-radius: calc(10px * var(--round));
      }

      .field > span {
        grid-area: 1 / 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .c1 {
        animation-name: c1;
      }
      .c2 {
        opacity: 0;
        animation-name: c2;
      }
      .ph {
        opacity: 0;
        color: var(--_muted);
        animation-name: ph;
      }

      @keyframes c1 {
        0%,
        3% {
          opacity: 1;
        }
        3.6%,
        24% {
          opacity: 0;
        }
        26%,
        33% {
          opacity: 1;
        }
        34%,
        97% {
          opacity: 0;
        }
        100% {
          opacity: 1;
        }
      }
      @keyframes c2 {
        0%,
        33% {
          opacity: 0;
        }
        34%,
        43% {
          opacity: 1;
        }
        43.6%,
        100% {
          opacity: 0;
        }
      }
      @keyframes ph {
        0%,
        3% {
          opacity: 0;
        }
        3.6%,
        23.5% {
          opacity: 1;
        }
        24.5%,
        43% {
          opacity: 0;
        }
        43.6%,
        96.5% {
          opacity: 1;
        }
        97.5%,
        100% {
          opacity: 0;
        }
      }

      .send {
        display: grid;
        place-items: center;
        flex: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--clay-d);
        animation: send var(--t) infinite;
      }

      .send svg {
        width: 14px;
        height: 14px;
        fill: none;
        stroke: var(--paper);
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      @keyframes send {
        0%,
        2.2% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        3% {
          transform: scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        4.2%,
        42.2% {
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        43% {
          transform: scale(0.96);
          animation-timing-function: var(--ease-out);
        }
        44.2%,
        100% {
          transform: scale(1);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        /* The bubble no longer rises out of the field or drops back into it;
           it fades in place, and the composer's text coming back carries the
           undo on its own. Presses go. The window still drains — it is the
           content. Every timeline stretches by the same 1.5. */
        .send,
        .undo {
          animation: none;
        }

        .bubble {
          animation-name: bubble-still;
        }

        .meta {
          animation-name: bubble-still;
          animation-delay: calc(var(--_lag) * 1.5);
        }

        @keyframes bubble-still {
          0%,
          3% {
            opacity: 0;
          }
          5.4%,
          23% {
            opacity: 1;
          }
          25%,
          43% {
            opacity: 0;
          }
          45.4%,
          95% {
            opacity: 1;
          }
          96.8%,
          100% {
            opacity: 0;
          }
        }

        .tick path {
          stroke-dashoffset: 0;
          animation-name: tick-still;
        }

        @keyframes tick-still {
          0%,
          85% {
            opacity: 0;
          }
          86.8%,
          100% {
            opacity: 1;
          }
        }

        .bubble,
        .held,
        .solid,
        .v1,
        .v2,
        .drain,
        .meta,
        .tick path,
        .label > span,
        .c1,
        .c2,
        .ph {
          animation-duration: calc(var(--t) * 1.5);
        }
      }
    </style>
  </head>
  <body>
    <div
      class="card"
      role="img"
      aria-label="A message is sent but held: the bubble is tinted with a dashed edge and a thin bar drains between Sending and Undo. Undo is pressed and the bubble drops back into the composer with its text; the time is corrected, it is sent again, and when the bar runs out the bubble turns solid and a tick reads Sent"
    >
      <div class="head"><b>Design team</b><span>4 members</span></div>
      <div class="thread">
        <div class="in">When is standup?</div>
        <div class="bubble">
          <div class="layer held">
            <span class="v1">Standup moved to 10:30</span>
            <span class="v2">Standup moved to 11:00</span>
          </div>
          <div class="layer solid"><span>Standup moved to 11:00</span></div>
        </div>
        <div class="meta">
          <span class="label">
            <span class="l-held"
              >Sending<span class="track"><span class="drain"></span></span
              ><span class="undo">Undo</span></span
            >
            <span class="l-sent"
              >Sent<svg class="tick" viewBox="0 0 12 12" aria-hidden="true">
                <path d="M1 6.5 L4.5 10 L11 2" /></svg
            ></span>
          </span>
        </div>
      </div>
      <div class="composer">
        <div class="field">
          <span class="c1">Standup moved to 10:30</span>
          <span class="c2">Standup moved to 11:00</span>
          <span class="ph">Message Design team</span>
        </div>
        <span class="send" aria-hidden="true">
          <svg viewBox="0 0 14 14"><path d="M7 12 V2 M2.5 6.5 L7 2 L11.5 6.5" /></svg>
        </span>
      </div>
    </div>
  </body>
</html>