23 CSS Checkboxes

Draw Stroke Checkmark

The checkmark draws itself using SVG stroke-dashoffset animation on :checked.

Pure CSS MIT licensed

Draw Stroke Checkmark the 3rd 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-draw">
  <input class="cb-draw__input" type="checkbox" checked />
  <span class="cb-draw__box">
    <svg class="cb-draw__svg" viewBox="0 0 16 12" fill="none">
      <polyline
        class="cb-draw__path"
        points="1,6 6,11 15,1"
        stroke="#1ed98a"
        stroke-width="2.2"
        stroke-linecap="round"
        stroke-linejoin="round"
      />
    </svg>
  </span>
  <span>Draw stroke checkmark</span>
</label>
.cb-draw {
  display: inline-flex; align-items: center;
  gap: 10px; cursor: pointer; user-select: none;
}
.cb-draw__input { display: none; }
.cb-draw__box {
  width: 24px; height: 24px; border-radius: 7px;
  border: 2px solid rgba(30,217,138,.35);
  background: rgba(30,217,138,.05);
  display: flex; align-items: center;
  justify-content: center;
  transition: border-color .3s, background .3s;
}
.cb-draw__input:checked + .cb-draw__box {
  border-color: #1ed98a;
  background: rgba(30,217,138,.12);
}
.cb-draw__svg { width: 14px; height: 10px; }
.cb-draw__path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  transition: stroke-dashoffset .35s
    cubic-bezier(.23,1,.32,1) .05s;
}
.cb-draw__input:checked
  + .cb-draw__box .cb-draw__path {
  stroke-dashoffset: 0;
}

Search CodeFronts

Loading…