AI CSS Animations

Growing Plant Checkbox

A sprout in a pot that grows when you tick the task: the stem stretches up, two leaves unfurl on a stagger and a flower blooms at the top. A gentle reward for habit trackers and daily to-do lists.

Also known as: plant grow animation css, habit tracker checkbox, water the plants checkbox.

HTML

<label class="chk-growing-plant">
  <input type="checkbox">
  <span class="chk-growing-plant-icon" aria-hidden="true">
    <i class="chk-growing-plant-stem"></i>
    <i class="chk-growing-plant-leaf-l"></i>
    <i class="chk-growing-plant-leaf-r"></i>
    <i class="chk-growing-plant-bud"></i>
    <i class="chk-growing-plant-pot"></i>
  </span>
  <span class="chk-growing-plant-text">Water the plants</span>
</label>

CSS

.chk-growing-plant {
  --c: var(--chk-color, #3b82f6);
  font-size: var(--chk-size, 24px);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  line-height: 1.3;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  gap: 0.6em;}
.chk-growing-plant input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.chk-growing-plant-icon {
  position: relative;
  flex: none;
  width: 1.6em;
  height: 2.15em;
  border-radius: 0.3em;
}
.chk-growing-plant-icon i {
  position: absolute;
  left: 50%;
}
.chk-growing-plant-pot {
  bottom: 0;
  width: 1.2em;
  height: 0.75em;
  margin-left: -0.6em;
  background: linear-gradient(#c2410c 0 0.2em, #ea7a45 0.2em);
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
}
.chk-growing-plant-stem {
  bottom: 0.65em;
  width: 0.12em;
  height: 1.1em;
  margin-left: -0.06em;
  border-radius: 0.1em;
  background: #2f9e5b;
  transform-origin: 50% 100%;
  transform: scaleY(0.42);
  transition: transform 0.3s ease-in 0.1s;
}
.chk-growing-plant-leaf-l,
.chk-growing-plant-leaf-r {
  bottom: 1.1em;
  width: 0.6em;
  height: 0.32em;
  background: #3fbf73;
  transition: transform 0.25s ease-in;
}
.chk-growing-plant-leaf-r {
  border-radius: 0 100%;
  transform-origin: 0 100%;
  transform: translateY(0.12em) scale(0.5) rotate(-10deg);
}
.chk-growing-plant-leaf-l {
  margin-left: -0.6em;
  border-radius: 100% 0;
  transform-origin: 100% 100%;
  transform: translateY(0.12em) scale(0.5) rotate(10deg);
}
.chk-growing-plant-bud {
  bottom: 1.55em;
  width: 0.5em;
  height: 0.5em;
  margin-left: -0.25em;
  border-radius: 50%;
  background: radial-gradient(circle, #fde68a 0 0.08em, var(--c) 0.09em);
  box-shadow: 0 0 0 0.06em color-mix(in srgb, var(--c) 35%, transparent);
  transform: translateY(0.6em) scale(0);
  transition: transform 0.2s ease-in;
}
.chk-growing-plant-text {
  transition: color 0.25s ease;
}
.chk-growing-plant input:checked + .chk-growing-plant-icon .chk-growing-plant-stem {
  transform: scaleY(1);
  transition: transform 0.5s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.chk-growing-plant input:checked + .chk-growing-plant-icon .chk-growing-plant-leaf-r {
  transform: translateY(0) scale(1) rotate(-25deg);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}
.chk-growing-plant input:checked + .chk-growing-plant-icon .chk-growing-plant-leaf-l {
  transform: translateY(0) scale(1) rotate(25deg);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s;
}
.chk-growing-plant input:checked + .chk-growing-plant-icon .chk-growing-plant-bud {
  transform: translateY(0) scale(1);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.45s;
}
.chk-growing-plant input:checked ~ .chk-growing-plant-text {
  color: var(--c);
}
.chk-growing-plant input:focus-visible + .chk-growing-plant-icon {
  outline: 0.12em solid var(--c);
  outline-offset: 0.18em;
}

@media (prefers-reduced-motion: reduce) {
  .chk-growing-plant, .chk-growing-plant *, .chk-growing-plant::before, .chk-growing-plant::after, .chk-growing-plant *::before, .chk-growing-plant *::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