Pill Tabs Switcher
Nav-pill tabs that swap the content panel below.
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">
<ul class="nav nav-pills mb-3" id="ptTabs"><li class="nav-item"><button class="nav-link active" data-pt="0">Account</button></li><li class="nav-item"><button class="nav-link" data-pt="1">Billing</button></li><li class="nav-item"><button class="nav-link" data-pt="2">Team</button></li></ul>
<div class="small" id="ptContent">Account settings and profile info.</div>
</div></div>var data=['Account settings and profile info.','Billing details and invoices.','Manage your team members.'];
var tabs=document.querySelectorAll('#ptTabs [data-pt]'),c=document.getElementById('ptContent');
tabs.forEach(function(b){b.onclick=function(){tabs.forEach(function(x){x.classList.remove('active')});b.classList.add('active');c.textContent=data[+b.dataset.pt]}});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.