</> ConvertAtlas Developer Tools
Bootstrap 5 · Beginner

Tab Content Switcher

A button-group tab switcher that swaps content panes.

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:360px"><div class="card-body">
  <div class="btn-group btn-group-sm w-100 mb-3" id="tlTabs"><button class="btn btn-primary" data-t="0">Recent</button><button class="btn btn-outline-primary" data-t="1">Popular</button><button class="btn btn-outline-primary" data-t="2">Saved</button></div>
  <div id="tlContent" class="small">Recent items appear here.</div>
</div></div>
var data=['Recent items appear here.','Popular items, sorted by views.','Your saved items live here.'];
var tabs=document.querySelectorAll('#tlTabs button'),content=document.getElementById('tlContent');
tabs.forEach(function(b){b.onclick=function(){tabs.forEach(function(x){x.className='btn btn-outline-primary'});b.className='btn btn-primary';content.textContent=data[+b.dataset.t]}});
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.