Snippets Checkbox

Bootstrap 5 Animated Custom Checkboxes and Radio Buttons

Hand-drawn checkboxes and radio buttons with an animated tick and a springy selection dot, built on native inputs so keyboard and screen readers work.

Bootstrap 5 Bootstrap 6 No jQuery Aug 2019 2.6K views

<section class="wdw-stage">
  <div class="container" style="max-width:1040px">
    <div class="text-center mb-5">
      <span class="wdw-eyebrow">Form controls</span>
      <h1 class="wdw-heading display-6 mt-2 mb-2" style="text-wrap:balance">Animated checkboxes, radios and switches</h1>
      <p class="wdw-muted mb-0 mx-auto" style="max-width:36rem">Selectable tiles with a drawn check, a springy radio dot and full keyboard support.</p>
    </div>
    <div class="row g-4">
      <div class="col-lg-4 col-md-6">
        <fieldset class="wdw-card p-4 h-100">
          <legend class="h6 fw-bold mb-3 float-start w-100" id="g1">Notify me about</legend>
          <label class="wdw-opt"><input type="checkbox"><span class="wdw-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7"/></svg></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a8 8 0 0 1-11.5 7.2L4 20l1-4.5A8 8 0 1 1 21 12z"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">New comments</span><span class="wdw-opt-help">Replies to your posts</span></span></label><label class="wdw-opt"><input type="checkbox" checked><span class="wdw-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7"/></svg></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v4M12 17v4M3 12h4M17 12h4M6 6l2.5 2.5M15.5 15.5L18 18M18 6l-2.5 2.5M8.5 15.5L6 18"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Product updates</span><span class="wdw-opt-help">New features and fixes</span></span></label><label class="wdw-opt"><input type="checkbox"><span class="wdw-box" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M5 12.5l4.5 4.5L19 7"/></svg></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Weekly digest</span><span class="wdw-opt-help">Every Monday morning</span></span></label>
        </fieldset>
      </div>
      <div class="col-lg-4 col-md-6">
        <fieldset class="wdw-card p-4 h-100">
          <legend class="h6 fw-bold mb-3 float-start w-100" id="g2">Delivery speed</legend>
          <label class="wdw-opt"><input type="radio" name="speed"><span class="wdw-radio" aria-hidden="true"></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M3 7h11v9H3zM14 10h4l3 3v3h-7"/><circle cx="7" cy="18" r="1.5"/><circle cx="17" cy="18" r="1.5"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Standard</span><span class="wdw-opt-help">Arrives in 5 days</span></span></label><label class="wdw-opt"><input type="radio" name="speed" checked><span class="wdw-radio" aria-hidden="true"></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M13 3L5 14h6l-1 7 8-11h-6z"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Express</span><span class="wdw-opt-help">Arrives in 2 days</span></span></label><label class="wdw-opt"><input type="radio" name="speed"><span class="wdw-radio" aria-hidden="true"></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Same day</span><span class="wdw-opt-help">Order before 2 pm</span></span></label>
        </fieldset>
      </div>
      <div class="col-lg-4 col-md-6">
        <fieldset class="wdw-card p-4 h-100">
          <legend class="h6 fw-bold mb-3 float-start w-100" id="g3">Preferences</legend>
          <label class="wdw-opt"><span class="form-check form-switch m-0 p-0"><input class="form-check-input wdw-switch m-0" type="checkbox" role="switch" checked></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 8 3 8H3s3-1 3-8M10 20a2 2 0 0 0 4 0"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Push alerts</span><span class="wdw-opt-help">On this device</span></span></label><label class="wdw-opt"><span class="form-check form-switch m-0 p-0"><input class="form-check-input wdw-switch m-0" type="checkbox" role="switch"></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="3"/><path d="M3 8l9 6 9-6"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Email receipts</span><span class="wdw-opt-help">After every order</span></span></label><label class="wdw-opt"><span class="form-check form-switch m-0 p-0"><input class="form-check-input wdw-switch m-0" type="checkbox" role="switch" checked></span><span class="wdw-icon wdw-opt-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l8 3v6c0 4.5-3.4 8-8 9-4.6-1-8-4.5-8-9V6z"/></svg></span><span class="wdw-opt-text"><span class="wdw-opt-title">Two-step login</span><span class="wdw-opt-help">Extra account security</span></span></label>
        </fieldset>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 6.0.0-alpha.1 (ES modules, no jQuery). Load Bootstrap through an import map and run the JavaScript as type="module" — the downloaded file is already set up that way. Alpha releases can still change class names.

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.