AI CSS Animations

Stamp Checkmark Checkbox

The tick comes down like a rubber stamp: it drops from twice its size, lands tilted over the edges of the box and the box flinches from the impact. Two keyframes, timed so the flinch hits on contact.

Also known as: rubber stamp checkbox, check stamp animation, stamped tick css.

HTML

<label class="chk-stamp-checkbox">
  <input type="checkbox">
  <span class="chk-stamp-checkbox-box">
    <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 12.5l5.5 5.5L21 5"/></svg>
  </span>
  Verified
</label>

CSS

.chk-stamp-checkbox {
  --c: var(--chk-color, #3b82f6);
  font-size: var(--chk-size, 24px);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 0.7em;
  font-weight: 600;}
.chk-stamp-checkbox input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.chk-stamp-checkbox-box {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  flex: none;
  width: 1.375em;
  height: 1.375em;
  border: 0.14em solid color-mix(in srgb, currentColor 38%, transparent);
  border-radius: 0.25em;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}
.chk-stamp-checkbox-box svg {
  display: block;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 1.5em;
  height: 1.5em;
  overflow: visible;
  stroke: var(--c);
  stroke-width: 3.6;
  opacity: 0;
  transform: rotate(-10deg) scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease-in;
}
.chk-stamp-checkbox input:checked + .chk-stamp-checkbox-box {
  border-color: color-mix(in srgb, var(--c) 60%, transparent);
  background: color-mix(in srgb, var(--c) 10%, transparent);
  animation: chk-stamp-checkbox-flinch 0.3s ease-out 0.2s;
}
.chk-stamp-checkbox input:checked + .chk-stamp-checkbox-box svg {
  opacity: 1;
  transform: rotate(-10deg) scale(1);
  animation: chk-stamp-checkbox-slam 0.38s;
}
.chk-stamp-checkbox input:focus-visible + .chk-stamp-checkbox-box {
  outline: 0.125em solid var(--c);
  outline-offset: 0.18em;
}
@keyframes chk-stamp-checkbox-slam {
  0% { opacity: 0; transform: rotate(-26deg) scale(2.3); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.4); }
  55% { opacity: 1; transform: rotate(-8deg) scale(0.9); animation-timing-function: ease-out; }
  78% { transform: rotate(-11deg) scale(1.05); }
  100% { opacity: 1; transform: rotate(-10deg) scale(1); }
}
@keyframes chk-stamp-checkbox-flinch {
  0%, 100% { transform: none; }
  30% { transform: scale(0.88) rotate(2deg); }
  65% { transform: scale(1.04) rotate(-1deg); }
}

@media (prefers-reduced-motion: reduce) {
  .chk-stamp-checkbox, .chk-stamp-checkbox *, .chk-stamp-checkbox::before, .chk-stamp-checkbox::after, .chk-stamp-checkbox *::before, .chk-stamp-checkbox *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --chk-color on the element or a parent. Currently previewing #3b82f6.
  • Size: set --chk-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 24px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar checkboxes