Back to the library

Select — indeterminate parent

Variant: Indeterminate

A "select all" parent over three children, walking through empty, mixed and checked. The children are checked one at a time, 700ms apart, on the same rule as the rest of the set: the fill starts as the 80ms press bottoms out and the tick follows 40ms later. The parent is never pressed on the way up. It fills 20ms behind the first child, and that small lag is the cue that its state comes from the children rather than being chosen. Mixed is a dash, not a smaller tick, because "some" must never be mistakable for "all" at a glance. The dash is drawn from its left end, which is also where the tick starts. When the last child lands, the dash retracts into that point on ease-in-out and the tick draws out of it, so the parent reads as one stroke changing its mind rather than one glyph swapped for another. The dash animates its length, not its scale, so its round caps stay round. Then the parent is clicked once and all four boxes clear on the same 100ms frame. It is one command, and a staggered clear would suggest four. Reach for it in file pickers, permission trees, table headers and bulk-action bars, anywhere a checkbox stands for a group.

controllistsvgmorphloop

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>Select — indeterminate parent</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 — 4.8s: three child checks 700ms apart, a hold on "all", one
           parent click that clears everything, and a rest. */
        --cycle: 4.8s;
        --t: calc(var(--cycle) / var(--speed));

        --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
        --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
        --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);
      }

      .list {
        width: min(232px, 84vw);
        padding: 6px 0;
        border-radius: calc(12px * var(--round));
        background: var(--paper);
        box-shadow: 0 1px 2px color-mix(in srgb, var(--slate) 10%, transparent);
        font-size: clamp(13px, 4vw, 14px);
        letter-spacing: -0.01em;
      }

      .row {
        display: flex;
        align-items: center;
        gap: 11px;
        height: 38px;
        padding: 0 14px;
      }

      .row.child {
        padding-left: 44px;
        color: color-mix(in srgb, var(--slate) 78%, transparent);
      }

      .row.parent {
        font-weight: 600;
        border-bottom: 1px solid color-mix(in srgb, var(--slate) 8%, transparent);
        margin-bottom: 4px;
      }

      .box {
        position: relative;
        flex: none;
        width: 20px;
        height: 20px;
        border-radius: calc(5px * var(--round));
        box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--slate) 32%, transparent);
      }

      .on {
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: var(--clay);
        opacity: 0;
        transform: scale(0.6);
      }

      .mark {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        fill: none;
        stroke: var(--ivory);
        stroke-width: 2.3;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      .tick {
        stroke-dasharray: 1;
        stroke-dashoffset: 1;
      }

      /* One rule for the whole set: the fill starts as the 80ms press bottoms
         out and the mark follows 40ms later. Children: the press and the draw are moments, so they share one
         keyframe list offset by 700ms. Each child's "checked" span ends on the
         same frame as the others, so that one gets its own list. */
      .child .box {
        animation: press var(--t) var(--_d) infinite backwards;
      }

      .child .tick {
        animation: draw var(--t) var(--_d) infinite backwards;
      }

      .c1 {
        --_d: 0s;
      }

      .c2 {
        --_d: calc(var(--t) * 0.14583);
      }

      .c3 {
        --_d: calc(var(--t) * 0.29167);
      }

      .c1 .on {
        animation: on-1 var(--t) infinite;
      }

      .c2 .on {
        animation: on-2 var(--t) infinite;
      }

      .c3 .on {
        animation: on-3 var(--t) infinite;
      }

      .parent .box {
        animation: press-parent var(--t) infinite;
      }

      .parent .on {
        animation: on-parent var(--t) infinite;
      }

      .dash {
        stroke-dasharray: 0 1;
        opacity: 0;
        animation: dash var(--t) infinite;
      }

      .parent .tick {
        animation: draw-parent var(--t) infinite;
      }

      @keyframes press {
        0%,
        12.5% {
          transform: scale(1);
          animation-timing-function: var(--ease-accent);
        }
        14.17% {
          transform: scale(0.88);
          animation-timing-function: var(--ease-out);
        }
        17.92%,
        100% {
          transform: scale(1);
        }
      }

      @keyframes draw {
        0%,
        15% {
          stroke-dashoffset: 1;
          animation-timing-function: var(--ease-out);
        }
        18.33%,
        84.9% {
          stroke-dashoffset: 0;
        }
        85%,
        100% {
          stroke-dashoffset: 1;
        }
      }

      @keyframes on-1 {
        0%,
        14.17% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        17.08%,
        70.42% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        72.5%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      @keyframes on-2 {
        0%,
        28.75% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        31.67%,
        70.42% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        72.5%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      @keyframes on-3 {
        0%,
        43.33% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        46.25%,
        70.42% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        72.5%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      /* The parent is never pressed on the way up — it changes because its
         children did, 20ms behind the first child's fill, and that lag is the cue that
         its state is derived rather than chosen. */
      @keyframes on-parent {
        0%,
        14.58% {
          opacity: 0;
          transform: scale(0.6);
          animation-timing-function: var(--ease-out);
        }
        17.5%,
        70.42% {
          opacity: 1;
          transform: scale(1);
          animation-timing-function: var(--ease-out);
        }
        72.5%,
        100% {
          opacity: 0;
          transform: scale(1);
        }
      }

      /* Mixed is a dash, not a smaller tick: "some" must never be mistakable
         for "all" at a glance. The dash is drawn from its left end, which is
         also where the tick starts. When the last child lands, the dash
         retracts into that point and the tick draws out of it, so the parent
         reads as one stroke changing its mind rather than two glyphs swapping.
         Animating the dash length instead of scaleX keeps the round caps round. */
      @keyframes dash {
        0%,
        14.58% {
          opacity: 0;
          stroke-dasharray: 0.3 1;
          animation-timing-function: var(--ease-out);
        }
        17.5%,
        43.75% {
          opacity: 1;
          stroke-dasharray: 1 1;
          animation-timing-function: var(--ease-in-out);
        }
        45.83%,
        100% {
          opacity: 0;
          stroke-dasharray: 0 1;
        }
      }

      @keyframes draw-parent {
        0%,
        44.58% {
          stroke-dashoffset: 1;
          animation-timing-function: var(--ease-out);
        }
        47.92%,
        84.9% {
          stroke-dashoffset: 0;
        }
        85%,
        100% {
          stroke-dashoffset: 1;
        }
      }

      /* Unchecking the parent is one command, so it clears all four boxes on
         the same 100ms frame. Staggering the clear would imply four actions. */
      @keyframes press-parent {
        0%,
        68.75% {
          transform: scale(1);
          animation-timing-function: var(--ease-accent);
        }
        70.42% {
          transform: scale(0.88);
          animation-timing-function: var(--ease-out);
        }
        74.17%,
        100% {
          transform: scale(1);
        }
      }

      @media (prefers-reduced-motion: reduce) {
        .box,
        .child .box,
        .parent .box {
          animation: none;
        }

        .tick,
        .child .tick,
        .parent .tick {
          stroke-dashoffset: 0;
          animation: none;
        }

        .on {
          transform: none !important;
        }

        .dash {
          stroke-dasharray: none;
          animation: dash-flat var(--t) infinite;
        }

        .parent .tick {
          opacity: 0;
          animation: tick-flat var(--t) infinite;
        }

        @keyframes dash-flat {
          0%,
          14.58% {
            opacity: 0;
          }
          17.5%,
          43.75% {
            opacity: 1;
          }
          45.83%,
          100% {
            opacity: 0;
          }
        }

        @keyframes tick-flat {
          0%,
          44.58% {
            opacity: 0;
          }
          47.92%,
          100% {
            opacity: 1;
          }
        }
      }
    </style>
  </head>
  <body>
    <div
      class="list"
      role="img"
      aria-label="Three files checked one by one; the parent checkbox goes from empty to mixed to checked, then clears all three at once"
    >
      <div class="row parent">
        <span class="box">
          <span class="on">
            <svg class="mark" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
              <path class="dash" d="M5.5 10.4 L14.5 10.4" pathLength="1" />
              <path class="tick" d="M5.5 10.4 L8.6 13.4 L14.5 7" pathLength="1" />
            </svg>
          </span>
        </span>
        <span>All files</span>
      </div>
      <div class="row child c1">
        <span class="box">
          <span class="on">
            <svg class="mark" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
              <path class="tick" d="M5.5 10.4 L8.6 13.4 L14.5 7" pathLength="1" />
            </svg>
          </span>
        </span>
        <span>brief.pdf</span>
      </div>
      <div class="row child c2">
        <span class="box">
          <span class="on">
            <svg class="mark" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
              <path class="tick" d="M5.5 10.4 L8.6 13.4 L14.5 7" pathLength="1" />
            </svg>
          </span>
        </span>
        <span>notes.md</span>
      </div>
      <div class="row child c3">
        <span class="box">
          <span class="on">
            <svg class="mark" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
              <path class="tick" d="M5.5 10.4 L8.6 13.4 L14.5 7" pathLength="1" />
            </svg>
          </span>
        </span>
        <span>plan.key</span>
      </div>
    </div>
  </body>
</html>

The variant family

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