Bootstrap 5 Modal with Vertical Tabs
A modal with vertical side tabs for apps, a help centre, communities and learning preferences, collapsing to a scrollable tab strip on phones.
<section class="mt-section wdw-stage">
<header class="mt-top d-flex align-items-center justify-content-between px-3 px-md-4 py-3 bg-body border-bottom">
<span class="fw-bold d-flex align-items-center gap-2"><span class="mt-brand" aria-hidden="true"></span>Acme workspace</span>
<button type="button" class="btn btn-sm btn-outline-primary rounded-pill px-3" data-bs-toggle="modal" data-bs-target="#mt-modal">Open hub</button>
</header>
<div class="container text-center mt-wrap">
<span class="wdw-eyebrow mb-3">Modal + tabs</span>
<h1 class="display-5 wdw-heading mb-3">Everything in one place</h1>
<p class="lead text-body-secondary mx-auto mb-4 mt-lead">Open a modal with side tabs for your apps, help articles, communities and learning preferences.</p>
<button type="button" class="btn btn-primary rounded-pill px-5" data-bs-toggle="modal" data-bs-target="#mt-modal">Open hub</button>
</div>
<div class="modal fade" id="mt-modal" tabindex="-1" aria-labelledby="mt-title" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content border-0 rounded-4 overflow-hidden">
<div class="modal-header border-0 pb-2 px-4 pt-4">
<div><h2 class="modal-title h4 wdw-heading mb-0" id="mt-title">Your hub</h2><p class="text-body-secondary small mb-0">Workspace <span aria-hidden="true">·</span> <span id="mt-section" aria-live="polite">My Apps</span></p></div>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body px-4 mt-body">
<div class="row g-4">
<div class="col-md-4 d-flex flex-column gap-3">
<div class="nav nav-pills flex-md-column gap-1 mt-nav" role="tablist" aria-orientation="vertical">
<button class="nav-link text-start d-flex align-items-center gap-2 active" id="mt-tab-0" data-bs-toggle="pill" data-bs-target="#mt-pane-0" type="button" role="tab" aria-controls="mt-pane-0" aria-selected="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="2"/><rect x="14" y="3" width="7" height="7" rx="2"/><rect x="3" y="14" width="7" height="7" rx="2"/><rect x="14" y="14" width="7" height="7" rx="2"/></svg><span>My Apps</span></button>
<button class="nav-link text-start d-flex align-items-center gap-2" id="mt-tab-1" data-bs-toggle="pill" data-bs-target="#mt-pane-1" type="button" role="tab" aria-controls="mt-pane-1" aria-selected="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 5a2 2 0 0 1 2-2h13v16H6a2 2 0 0 0-2 2z"/><path d="M4 21V5"/></svg><span>Knowledge Center</span></button>
<button class="nav-link text-start d-flex align-items-center gap-2" id="mt-tab-2" data-bs-toggle="pill" data-bs-target="#mt-pane-2" type="button" role="tab" aria-controls="mt-pane-2" aria-selected="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="8" r="3.500"/><path d="M2.500 20a6.500 6.500 0 0 1 13 0"/><path d="M16 4.500a3.500 3.500 0 0 1 0 7M21.500 20a6.500 6.500 0 0 0-4-6"/></svg><span>Communities</span></button>
<button class="nav-link text-start d-flex align-items-center gap-2" id="mt-tab-3" data-bs-toggle="pill" data-bs-target="#mt-pane-3" type="button" role="tab" aria-controls="mt-pane-3" aria-selected="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 9l10-5 10 5-10 5z"/><path d="M6 11.500V17c3 2.500 9 2.500 12 0v-5.500"/></svg><span>Education</span></button>
</div>
<div class="mt-storage mt-auto d-none d-md-block" aria-label="Storage usage">
<div class="d-flex justify-content-between small mb-2"><span class="fw-semibold">Storage</span><span class="text-body-secondary">6.2 of 10 GB</span></div>
<div class="progress" role="progressbar" aria-label="Storage used" aria-valuenow="62" aria-valuemin="0" aria-valuemax="100" style="height:6px"><div class="progress-bar" style="width:62%"></div></div>
</div>
</div>
<div class="col-md-8"><div class="tab-content">
<div class="tab-pane fade show active" id="mt-pane-0" role="tabpanel" aria-labelledby="mt-tab-0" tabindex="0">
<h3 class="h5 fw-bold mb-1">My Apps</h3><p class="text-body-secondary small">Your most used and suggested apps.</p>
<div class="d-flex flex-wrap gap-2 mb-4" role="group" aria-label="Pinned apps"><input type="checkbox" class="btn-check" id="mt-chip0" autocomplete="off" checked><label class="mt-chip rounded-pill" for="mt-chip0">WhatsApp</label><input type="checkbox" class="btn-check" id="mt-chip1" autocomplete="off"><label class="mt-chip rounded-pill" for="mt-chip1">Instagram</label><input type="checkbox" class="btn-check" id="mt-chip2" autocomplete="off" checked><label class="mt-chip rounded-pill" for="mt-chip2">Chrome</label><input type="checkbox" class="btn-check" id="mt-chip3" autocomplete="off"><label class="mt-chip rounded-pill" for="mt-chip3">LinkedIn</label></div>
<h4 class="h6 text-uppercase text-body-secondary fw-semibold">Suggested</h4>
<div class="list-group mt-apps"><a href="#" class="list-group-item list-group-item-action d-flex align-items-center gap-3 border-0 rounded-3 px-2 py-2"><span class="mt-app wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><ellipse cx="12" cy="12" rx="3.500" ry="6"/></svg></span><div><div class="fw-semibold">Opera Browser</div><small class="text-body-secondary">One of the best browsers</small></div><span class="ms-auto d-flex align-items-center gap-1 text-body-secondary small mt-open">Open<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg></span></a><a href="#" class="list-group-item list-group-item-action d-flex align-items-center gap-3 border-0 rounded-3 px-2 py-2"><span class="mt-app wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8V5h3M20 8V5h-3M4 16v3h3M20 16v3h-3"/><path d="M4 12h16"/></svg></span><div><div class="fw-semibold">CamScanner</div><small class="text-body-secondary">Easily scan your documents</small></div><span class="ms-auto d-flex align-items-center gap-1 text-body-secondary small mt-open">Open<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg></span></a><a href="#" class="list-group-item list-group-item-action d-flex align-items-center gap-3 border-0 rounded-3 px-2 py-2"><span class="mt-app wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 9l10-5 10 5-10 5z"/><path d="M6 11.500V17c3 2.500 9 2.500 12 0v-5.500"/></svg></span><div><div class="fw-semibold">Coursera</div><small class="text-body-secondary">Learn online from top universities</small></div><span class="ms-auto d-flex align-items-center gap-1 text-body-secondary small mt-open">Open<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 6 6 6-6 6"/></svg></span></a></div>
</div>
<div class="tab-pane fade" id="mt-pane-1" role="tabpanel" aria-labelledby="mt-tab-1" tabindex="0">
<h3 class="h5 fw-bold mb-1">Knowledge Center</h3><p class="text-body-secondary small">Find guides for the product you use.</p>
<label for="mt-product" class="form-label small fw-semibold">Product</label>
<select id="mt-product" class="form-select mb-4"><option selected disabled>Select product</option><option>Product 1</option><option>Product 2</option><option>Product 3</option></select>
<h4 class="h6 text-uppercase text-body-secondary fw-semibold">Popular topics</h4>
<div class="list-group">
<a href="#" class="list-group-item list-group-item-action">Getting started</a>
<a href="#" class="list-group-item list-group-item-action">Creating tests</a>
<a href="#" class="list-group-item list-group-item-action">Running tests</a>
</div>
</div>
<div class="tab-pane fade" id="mt-pane-2" role="tabpanel" aria-labelledby="mt-tab-2" tabindex="0">
<div class="d-flex justify-content-between align-items-start mb-3"><div><h3 class="h5 fw-bold mb-1">Communities</h3><p class="text-body-secondary small mb-0">Groups you belong to.</p></div><button type="button" class="btn btn-primary btn-sm rounded-pill px-3">New community</button></div>
<div class="vstack gap-3">
<div class="p-3 border rounded-4 d-flex justify-content-between align-items-center"><div><div class="fw-semibold">Community 1</div><small class="text-body-secondary">Design & product</small></div><span class="badge text-bg-light border rounded-pill">27 members</span></div>
<div class="p-3 border rounded-4 d-flex justify-content-between align-items-center"><div><div class="fw-semibold">Community 2</div><small class="text-body-secondary">Front-end engineers</small></div><span class="badge text-bg-light border rounded-pill">16 members</span></div>
</div>
</div>
<div class="tab-pane fade" id="mt-pane-3" role="tabpanel" aria-labelledby="mt-tab-3" tabindex="0">
<h3 class="h5 fw-bold mb-1">Education</h3><p class="text-body-secondary small">Tell us what you want to learn.</p>
<fieldset><legend class="h6 mb-3">What are you good at?</legend>
<div class="form-check mb-2"><input class="form-check-input" type="checkbox" id="mt-o1" checked><label class="form-check-label" for="mt-o1">Web development</label></div>
<div class="form-check mb-2"><input class="form-check-input" type="checkbox" id="mt-o2"><label class="form-check-label" for="mt-o2">Data structures & algorithms</label></div>
<div class="form-check mb-4"><input class="form-check-input" type="checkbox" id="mt-o3"><label class="form-check-label" for="mt-o3">Design</label></div>
</fieldset>
</div>
</div></div>
</div>
</div>
<div class="modal-footer border-0 px-4 pb-4 pt-2">
<button type="button" class="btn btn-outline-secondary text-body rounded-pill px-4" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary rounded-pill px-4" data-bs-dismiss="modal">Save changes</button>
</div>
</div>
</div>
</div>
</section>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.mt-wrap{max-width:720px}
.mt-lead{max-width:520px}
.mt-nav .nav-link{color:var(--bs-body-color);min-height:44px;border-radius:.75rem}
.mt-nav .nav-link:hover:not(.active){background:var(--bs-tertiary-bg)}
@media (max-width:767.98px){.mt-nav{display:grid!important;grid-template-columns:1fr 1fr;gap:.5rem!important}.mt-nav .nav-link{white-space:normal;line-height:1.2;padding:.5rem .75rem;border:1px solid var(--bs-border-color)}.mt-nav .nav-link.active{border-color:var(--bs-primary)}}
.mt-app{width:40px;height:40px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;flex:none}
.mt-section .tab-pane{transition:opacity .15s linear}
.mt-body{min-height:380px}
.mt-blur .modal-backdrop{--bs-backdrop-opacity:.35;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.mt-section.wdw-stage{flex-direction:column;align-items:stretch;justify-content:flex-start;padding-block:0}
.mt-section .mt-wrap{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-block:3rem;width:100%}
.mt-brand{width:22px;height:22px;border-radius:7px;background:var(--bs-primary)}
.mt-storage{padding:1rem;border-radius:1rem;background:var(--bs-tertiary-bg);border:1px solid var(--bs-border-color-translucent)}
.mt-chip{display:inline-flex;align-items:center;min-height:36px;padding:.35rem 1rem;font-size:.875rem;font-weight:600;cursor:pointer;border:1px solid var(--bs-border-color);background:var(--bs-body-bg);color:var(--bs-body-color);transition:background-color .15s,border-color .15s}
.mt-chip:hover{background:var(--bs-tertiary-bg)}
.btn-check:checked+.mt-chip{background:var(--bs-primary-bg-subtle);border-color:var(--bs-primary);color:var(--bs-primary-text-emphasis)}
.btn-check:focus-visible+.mt-chip{box-shadow:0 0 0 .2rem var(--bs-focus-ring-color)}
.mt-apps .list-group-item-action{color:var(--bs-body-color)}
.mt-apps .mt-open svg{transition:transform .15s}
.mt-apps .list-group-item-action:hover .mt-open{color:var(--bs-primary)!important}
.mt-apps .list-group-item-action:hover .mt-open svg{transform:translateX(2px)}
@media (max-width:575.98px){.mt-open{display:none!important}.mt-body{min-height:0}}
.mt-top{position:relative;z-index:1}
function initModalTabsReset() {
const modal = document.getElementById('mt-modal');
if (!modal) return;
// Always reopen on the first tab.
modal.addEventListener('hidden.bs.modal', () => {
const first = modal.querySelector('.mt-nav .nav-link');
if (first) bootstrap.Tab.getOrCreateInstance(first).show();
});
}
initModalTabsReset();
function initModalPreview() {
const modal = document.getElementById('mt-modal');
if (!modal) return;
// Show the modal once so the component is visible at a glance.
bootstrap.Modal.getOrCreateInstance(modal).show();
}
function initModalSectionLabel() {
const modal = document.getElementById('mt-modal');
const label = document.getElementById('mt-section');
if (!modal || !label) return;
modal.addEventListener('shown.bs.tab', (e) => {
const span = e.target.querySelector('span');
if (span) label.textContent = span.textContent;
});
modal.addEventListener('hidden.bs.modal', () => { label.textContent = 'My Apps'; });
}
initModalSectionLabel();
function initBackdropBlur() {
const modal = document.getElementById('mt-modal');
if (!modal) return;
modal.addEventListener('show.bs.modal', () => document.body.classList.add('mt-blur'));
modal.addEventListener('hidden.bs.modal', () => document.body.classList.remove('mt-blur'));
}
initBackdropBlur();
initModalPreview();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.