23 CSS Checkboxes

Liquid Fill Checkbox

A flood fill rises from the bottom using scaleY then reveals a white checkmark.

Pure CSS MIT licensed

Liquid Fill Checkbox the 7th of 23 designs in the 23 CSS Checkboxes collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.

Live preview

Open in playground

The code

<label class="cb-liquid">
  <input class="cb-liquid__input" type="checkbox" checked />
  <span class="cb-liquid__box">
    <span class="cb-liquid__fill"></span>
    <svg
      width="12"
      height="9"
      viewBox="0 0 14 11"
      fill="none"
      style="position: relative; z-index: 1"
    >
      <polyline
        points="1,5.5 5,9.5 13,1"
        stroke="white"
        stroke-width="2.2"
        stroke-linecap="round"
        stroke-linejoin="round"
      />
    </svg>
  </span>
  <span>Liquid fill checkbox</span>
</label>
.cb-liquid {
  display: inline-flex; align-items: center;
  gap: 10px; cursor: pointer; user-select: none;
}
.cb-liquid__input { display: none; }
.cb-liquid__box {
  width: 24px; height: 24px; border-radius: 7px;
  border: 2px solid rgba(61,232,245,.4);
  position: relative; overflow: hidden;
  display: flex; align-items: center;
  justify-content: center; color: transparent;
  transition: border-color .3s, color .3s;
}
.cb-liquid__fill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    #3de8f5, #06b6d4);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform .35s
    cubic-bezier(.23,1,.32,1);
}
.cb-liquid__input:checked + .cb-liquid__box {
  border-color: #3de8f5; color: #fff;
}
.cb-liquid__input:checked
  + .cb-liquid__box .cb-liquid__fill {
  transform: scaleY(1);
}

Search CodeFronts

Loading…