</> ConvertAtlas Developer Tools
Bootstrap 5 · Beginner

Size Picker

A size selector with a disabled out-of-stock option and add button.

Requires Bootstrap 5. Add the CDN tags below to your page (styles in <head>, scripts before </body>). The downloaded file already includes them.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<div class="card border-0 shadow-sm" style="max-width:320px"><div class="card-body">
  <div class="d-flex justify-content-between"><h6 class="fw-bold">Select size</h6><a href="#" class="small text-decoration-none">Size guide</a></div>
  <div class="d-flex gap-2 mt-2" id="szWrap"><button class="btn btn-outline-secondary" data-sz>S</button><button class="btn btn-outline-secondary" data-sz>M</button><button class="btn btn-outline-secondary" data-sz>L</button><button class="btn btn-outline-secondary" data-sz disabled>XL</button></div>
  <button class="btn btn-primary w-100 mt-3" id="szAdd" disabled>Select a size</button>
</div></div>
var add=document.getElementById('szAdd');
document.querySelectorAll('#szWrap [data-sz]').forEach(function(b){b.onclick=function(){document.querySelectorAll('#szWrap [data-sz]').forEach(function(x){x.className='btn btn-outline-secondary'});b.className='btn btn-primary';add.disabled=false;add.textContent='Add size '+b.textContent+' to cart'}});
Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.