29 CSS Checkboxes10 / 29

Pure CSSMIT licensed

Bouncy Pop Checkbox

A satisfying, tactile toggle: on check the mark overshoots its size with a spring cubic-bezier before settling, and the box gives a tiny squash. That physical bounce is what makes a checkbox feel alive — done entirely with transform.

Published Updated

Live Demo
Try it

The code

<section class="cb-10" aria-label="Bouncy pop checkboxes">
  <div class="cb-10__panel">
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input" checked><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Add to favourites</span></label>
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input"><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Remind me later</span></label>
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input"><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Follow this thread</span></label>
  </div>
</section>
.cb-10,
.cb-10 *,
.cb-10 *::before,
.cb-10 *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.cb-10 ::selection {
  background: oklch(0.62 0.19 25);
  color: #fff;
}

.cb-10 {
  --accent: oklch(0.6 0.19 25);
  font-family: 'Segoe UI',system-ui,sans-serif;
  width: 100%;
  min-height: 100vh;
  padding: 40px 20px;
  background: #fbf4f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-10__panel {
  width: min(400px,100%);
  background: #fff;
  border: 1px solid #f0dfda;
  border-radius: 14px;
  padding: 10px 14px;
}

.cb-10__row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 13px 8px;
}

.cb-10__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cb-10__box {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #e3b7ad;
  background: #fff;
  transition: background .2s,border-color .2s;
}

.cb-10__box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity .16s,transform .28s cubic-bezier(.34,1.7,.5,1);
  -webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.cb-10__input:checked ~ .cb-10__box {
  background: var(--accent);
  border-color: var(--accent);
  animation: cb-10-pop .32s ease;
}

.cb-10__input:checked ~ .cb-10__box::after {
  opacity: 1;
  transform: scale(1);
}

.cb-10__input:focus-visible ~ .cb-10__box {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.cb-10__label {
  font-size: 14.5px;
  color: #3a2a27;
}

@keyframes cb-10-pop {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(.82,.82);
  }

  70% {
    transform: scale(1.12,1.12);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-10__box,
    .cb-10__box::after {
    transition: opacity .15s;
    animation: none;
  }

  .cb-10__box::after {
    transform: scale(1);
  }
}
/* No JavaScript — an overshoot cubic-bezier + squash keyframe give the bounce. */
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS Checkboxe from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Bouncy Pop Checkbox
Source: https://codefronts.com/components/css-checkboxes/bouncy-pop-checkbox/

A satisfying, tactile toggle: on check the mark overshoots its size with a spring cubic-bezier before settling, and the box gives a tiny squash. That physical bounce is what makes a checkbox feel alive — done entirely with transform.
## HTML
```html
<section class="cb-10" aria-label="Bouncy pop checkboxes">
  <div class="cb-10__panel">
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input" checked><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Add to favourites</span></label>
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input"><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Remind me later</span></label>
    <label class="cb-10__row"><input type="checkbox" class="cb-10__input"><span class="cb-10__box" aria-hidden="true"></span><span class="cb-10__label">Follow this thread</span></label>
  </div>
</section>
```
## CSS
```css
.cb-10,
.cb-10 *,
.cb-10 *::before,
.cb-10 *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.cb-10 ::selection {
  background: oklch(0.62 0.19 25);
  color: #fff;
}

.cb-10 {
  --accent: oklch(0.6 0.19 25);
  font-family: 'Segoe UI',system-ui,sans-serif;
  width: 100%;
  min-height: 100vh;
  padding: 40px 20px;
  background: #fbf4f2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-10__panel {
  width: min(400px,100%);
  background: #fff;
  border: 1px solid #f0dfda;
  border-radius: 14px;
  padding: 10px 14px;
}

.cb-10__row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 13px 8px;
}

.cb-10__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cb-10__box {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #e3b7ad;
  background: #fff;
  transition: background .2s,border-color .2s;
}

.cb-10__box::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity .16s,transform .28s cubic-bezier(.34,1.7,.5,1);
  -webkit-mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  mask: no-repeat center/15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.cb-10__input:checked ~ .cb-10__box {
  background: var(--accent);
  border-color: var(--accent);
  animation: cb-10-pop .32s ease;
}

.cb-10__input:checked ~ .cb-10__box::after {
  opacity: 1;
  transform: scale(1);
}

.cb-10__input:focus-visible ~ .cb-10__box {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.cb-10__label {
  font-size: 14.5px;
  color: #3a2a27;
}

@keyframes cb-10-pop {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(.82,.82);
  }

  70% {
    transform: scale(1.12,1.12);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-10__box,
    .cb-10__box::after {
    transition: opacity .15s;
    animation: none;
  }

  .cb-10__box::after {
    transform: scale(1);
  }
}
```

## JavaScript
```js
/* No JavaScript — an overshoot cubic-bezier + squash keyframe give the bounce. */
```

How this works

The state comes from :checked as usual, but the delight is in the timing function. The check glyph scales from 0 to slightly over 1 and back using a cubic-bezier with an overshoot (values >1), so it pops past its final size and springs back — the classic elastic feel.

The box itself runs a brief squash-and-stretch keyframe (scale on X/Y) on check for extra physicality. All motion is transform-only, so it composites on the GPU and never reflows. Standard sr-only input keeps it accessible with a :focus-visible ring.

Under prefers-reduced-motion the spring is replaced with a plain fade so motion-sensitive users still get clear feedback.

Make it yours

  • Dial the bounce with the check's cubic-bezier — raise the third/fourth values for more overshoot.
  • Adjust squash intensity in the cb-10-pop keyframes.
  • Recolour via --accent.
  • Slow or speed the pop with the transition duration.

Gotchas — read before shipping

  • Only transform should carry the bounce — never animate width/height, which would reflow.
  • Overshoot beziers can look broken if the duration is too long; keep it ~180–260ms.
  • Respect reduced-motion — springy overshoot is exactly the kind of motion that affects some users.

Browser support

ChromeSafariFirefoxEdge
111+15.4+113+111+

Floor set by oklch() as this demo is written. The core technique itself goes back further — Chrome 49+.

cubic-bezier overshoot + transform animation are universal.

Techniques used in this demo

Search CodeFronts

Loading…