Back to the library

Overlay — drawer push

Variant: Drawer push

A side panel that pushes instead of floats: the page yields 10px as the drawer arrives, both riding the same curve on the same clock so they read as one gesture. The push is the message — this panel shares a surface with the page rather than hovering above it. Ten pixels is enough to establish causality; more and the page reads as layout collapsing rather than making room. Use it for inspectors and detail rails that belong to the page beside them.

overlaytransitioncontrol

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>Overlay — drawer push</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 — every duration in the document runs off --t. */
        --cycle: 5.6s;
        --t: calc(var(--cycle) / var(--speed));

        /* The iOS drawer curve: fast off the mark, long settle. */
        --ease-accent: cubic-bezier(0.32, 0.72, 0, 1);
      }

      * {
        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);
      }

      .frame {
        position: relative;
        width: clamp(240px, 50vw, 360px);
        height: min(64vh, 66vw, 210px);
        border-radius: calc(12px * var(--round));
        background: var(--paper);
        border: 1px solid color-mix(in srgb, var(--slate) 10%, transparent);
        overflow: hidden;
      }

      /* The page yields 10px as the panel arrives — the push is the whole
         message. A dialog floats above the page; this panel shares a surface
         with it, and the page moving over proves it. Both ride the same
         curve on the same clock, so they read as one gesture, not a panel
         plus a coincidence. */
      .page {
        position: absolute;
        inset: 0;
        padding: 16px;
        display: grid;
        gap: 10px;
        align-content: start;
        animation: page-push var(--t) linear infinite;
      }

      @keyframes page-push {
        0%,
        8% {
          transform: translateX(0);
          animation-timing-function: var(--ease-accent);
        }
        14%,
        55% {
          transform: translateX(-10px);
          animation-timing-function: var(--ease-accent);
        }
        59.6%,
        100% {
          transform: translateX(0);
        }
      }

      .bar {
        height: 10px;
        border-radius: 5px;
        background: var(--oat);
      }

      .page .head {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 4px;
      }

      .page .dot {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--clay);
        flex: none;
      }

      /* Dim, don't shove: 10px of travel is enough to establish causality.
         More and the page starts to read as layout collapsing rather than
         making room. The scrim does the rest of the de-emphasis. */
      .scrim {
        position: absolute;
        inset: 0;
        background: color-mix(in srgb, var(--slate) 26%, transparent);
        opacity: 0;
        animation: scrim var(--t) linear infinite;
      }

      @keyframes scrim {
        0%,
        7.5% {
          opacity: 0;
          animation-timing-function: ease;
        }
        13.5%,
        55.5% {
          opacity: 1;
          animation-timing-function: ease;
        }
        60%,
        100% {
          opacity: 0;
        }
      }

      /* 336ms in, 258ms out, both on the drawer curve. The panel travels by
         its own width — translateX(105%) — so the choreography is independent
         of how wide it renders. */
      .panel {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 46%;
        background: var(--ivory);
        box-shadow: -10px 0 28px color-mix(in srgb, var(--slate) 14%, transparent);
        padding: 14px;
        display: grid;
        gap: 9px;
        align-content: start;
        transform: translateX(105%);
        animation: panel var(--t) linear infinite;
      }

      @keyframes panel {
        0%,
        8% {
          transform: translateX(105%);
          animation-timing-function: var(--ease-accent);
        }
        14%,
        55% {
          transform: translateX(0);
          animation-timing-function: var(--ease-accent);
        }
        59.6%,
        100% {
          transform: translateX(105%);
        }
      }

      .panel .title {
        font-size: 12.5px;
        font-weight: 600;
        letter-spacing: -0.01em;
        margin-bottom: 2px;
      }

      .panel .bar {
        height: 8px;
      }

      .panel .chip {
        width: 44%;
        height: 20px;
        border-radius: calc(6px * var(--round));
        background: var(--clay);
        margin-top: 4px;
      }

      @media (prefers-reduced-motion: reduce) {
        /* No travel: panel and dim simply trade places with the resting page. */
        .page {
          animation: none;
          transform: none;
        }

        .panel {
          transform: translateX(0);
          animation: panel-rm var(--t) linear infinite;
        }

        @keyframes panel-rm {
          0%,
          8% {
            opacity: 0;
            animation-timing-function: ease;
          }
          14%,
          55.5% {
            opacity: 1;
            animation-timing-function: ease;
          }
          60%,
          100% {
            opacity: 0;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="frame"
      role="img"
      aria-label="A side drawer sliding in while the page shifts over to make room"
    >
      <div class="page">
        <div class="head">
          <span class="dot"></span>
          <span class="bar" style="width: 36%"></span>
        </div>
        <span class="bar" style="width: 84%"></span>
        <span class="bar" style="width: 70%"></span>
        <span class="bar" style="width: 78%"></span>
        <span class="bar" style="width: 52%"></span>
      </div>
      <div class="scrim"></div>
      <div class="panel">
        <span class="title">Details</span>
        <span class="bar" style="width: 90%"></span>
        <span class="bar" style="width: 68%"></span>
        <span class="bar" style="width: 78%"></span>
        <span class="chip"></span>
      </div>
    </div>
  </body>
</html>

The variant family

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