Bootstrap 5 Responsive Mail Inbox Layout
A responsive mail inbox with a folder sidebar, select-all toolbar, starring and unread highlighting.
<section class="wdw-stage">
<div class="container" style="max-width: 62rem;">
<div class="wdw-card overflow-hidden">
<div class="row g-0">
<aside class="col-md-4 col-lg-3 p-3 p-lg-4 border-end-md bg-body-tertiary" aria-label="Mail folders">
<button type="button" class="btn btn-primary rounded-pill w-100 mb-3"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> Compose</button>
<ul class="nav nav-pills flex-md-column flex-wrap flex-md-nowrap gap-1 wdw-folders" id="mailFolders">
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100 active" data-folder="Inbox" aria-current="page"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-6l-2 3h-4l-2-3H2"/><path d="M5.5 5h13L22 12v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z"/></svg><span>Inbox</span><span class="badge rounded-pill text-bg-primary ms-auto">4</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Starred"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg><span>Starred</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Drafts"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg><span>Drafts</span><span class="badge rounded-pill text-bg-primary ms-auto">2</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Sent"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4z"/><path d="M22 2 11 13"/></svg><span>Sent</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Trash"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6"/></svg><span>Trash</span></button></li>
</ul>
</aside>
<div class="col-md-8 col-lg-9">
<div class="d-flex align-items-center gap-3 px-3 py-3 border-bottom">
<div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="mailAll" aria-label="Select all messages"></div>
<h2 class="h6 fw-bold mb-0 me-auto" id="mailTitle">Inbox</h2>
<span class="small text-body-secondary d-none d-sm-inline" id="mailCount" aria-live="polite">0 selected</span>
<button type="button" class="btn btn-sm btn-outline-primary rounded-pill" id="mailRead" disabled>Mark as read</button>
</div>
<ul class="list-unstyled mb-0 wdw-mail-list" id="mailList">
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m0" aria-label="Select message from Vishvjeet Patel"></div>
<button type="button" class="wdw-star on" aria-pressed="true" aria-label="Star message from Vishvjeet Patel"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">VP</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Vishvjeet Patel</span><time class="small text-body-secondary flex-shrink-0">Oct 28</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Quarterly roadmap review</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">Two items need your sign-off before Friday: the mobile onboarding rework and the analytics dashboard scope.</p>
</div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m1" aria-label="Select message from Anjali Sharma"></div>
<button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Anjali Sharma"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">AS</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Anjali Sharma</span><time class="small text-body-secondary flex-shrink-0">Oct 25</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Design tokens are ready</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">The new spacing and colour tokens are published. Take a look at the scale and tell me what feels off.</p>
</div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m2" aria-label="Select message from Mary Grace"></div>
<button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Mary Grace"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">MG</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Mary Grace</span><time class="small text-body-secondary flex-shrink-0">Oct 22</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Invoice #2041 paid</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">Thanks for the quick turnaround. The payment cleared this morning and the receipt is attached for your records.</p>
</div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m3" aria-label="Select message from Richard Hale"></div>
<button type="button" class="wdw-star on" aria-pressed="true" aria-label="Star message from Richard Hale"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">RH</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Richard Hale</span><time class="small text-body-secondary flex-shrink-0">Oct 21</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Standup notes, Tuesday</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">Short recap: the checkout fix shipped, the onboarding copy is in review and the analytics migration slips a day.</p>
</div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m4" aria-label="Select message from Priya Nair"></div>
<button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Priya Nair"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">PN</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Priya Nair</span><time class="small text-body-secondary flex-shrink-0">Oct 19</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Welcome to the beta</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">You are in. Here is how to invite your team, connect your calendar and get the most from the first week.</p>
</div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
<div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m5" aria-label="Select message from Tom Becker"></div>
<button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Tom Becker"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
<span class="wdw-avatar" aria-hidden="true">TB</span>
<div class="min-w-0 flex-grow-1">
<div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Tom Becker</span><time class="small text-body-secondary flex-shrink-0">Oct 17</time></div>
<p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Lunch on Friday?</button></p>
<p class="small text-body-secondary mb-0 wdw-preview">A few of us are heading to the new place near the station around noon. Let me know if you want a seat.</p>
</div>
</li>
</ul>
</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 */
@media (min-width: 768px) { .border-end-md { border-right: 1px solid var(--bs-border-color-translucent); } }
.wdw-folders { row-gap: .25rem; }
.wdw-folders .nav-link { border-radius: .75rem; min-height: 44px; white-space: nowrap; color: var(--bs-body-color); font-weight: 500; }
.wdw-folders .nav-link.active { color: #fff; }
[data-bs-theme="dark"] .wdw-folders .nav-link.active { color: #0f1117; }
.wdw-mail-row { border-bottom: 1px solid var(--bs-border-color-translucent); cursor: pointer; transition: background .15s; position: relative; }
.wdw-mail-row:last-child { border-bottom: 0; }
.wdw-mail-row:hover { background: var(--bs-tertiary-bg); }
.wdw-mail-row.selected { background: var(--bs-primary-bg-subtle); }
.wdw-mail-row.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--bs-primary); }
.wdw-from, .wdw-subject { font-size: .95rem; }
.wdw-mail-row.unread .wdw-from, .wdw-mail-row.unread .wdw-subject { font-weight: 700; color: var(--bs-emphasis-color); }
.wdw-preview { display: -webkit-box; -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.wdw-avatar { width: 2.5rem; height: 2.5rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: .8rem; font-weight: 700; color: var(--bs-primary-text-emphasis); background: var(--bs-primary-bg-subtle); }
.wdw-star { border: 0; background: none; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin: -.75rem -.5rem; color: var(--bs-secondary-color); line-height: 1; border-radius: .5rem; }
.wdw-star.on { color: var(--bs-warning-text-emphasis); }
.wdw-star.on svg { fill: var(--bs-warning); }
.min-w-0 { min-width: 0; }
@media (max-width: 575.98px) { .wdw-avatar { display: none; } }
.wdw-mail-list { border-top: 0; }
.wdw-open { border: 0; background: none; padding: 0; font: inherit; color: inherit; font-weight: inherit; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.wdw-open:focus-visible, .wdw-star:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; border-radius: .35rem; }
#mailRead:disabled { opacity: 1; color: var(--bs-secondary-color); border-color: var(--bs-border-color); background: transparent; }
(function initMailInbox() {
var list = document.getElementById('mailList');
if (!list) return;
var rows = Array.prototype.slice.call(list.querySelectorAll('[data-row]'));
var all = document.getElementById('mailAll');
var count = document.getElementById('mailCount');
var readBtn = document.getElementById('mailRead');
function sync() {
var checked = rows.filter(function (r) { return r.querySelector('input').checked; });
rows.forEach(function (r) { r.classList.toggle('selected', r.querySelector('input').checked); });
if (count) count.textContent = checked.length + ' selected';
if (readBtn) readBtn.disabled = !checked.length;
if (all) { all.checked = checked.length === rows.length; all.indeterminate = checked.length > 0 && checked.length < rows.length; }
}
list.addEventListener('click', function (e) {
var row = e.target.closest('[data-row]');
if (!row) return;
var star = e.target.closest('.wdw-star');
if (star) {
var on = star.classList.toggle('on');
star.setAttribute('aria-pressed', String(on));
return;
}
if (e.target.closest('.form-check')) { sync(); return; }
row.classList.remove('unread');
});
if (all) all.addEventListener('change', function () {
rows.forEach(function (r) { r.querySelector('input').checked = all.checked; });
sync();
});
if (readBtn) readBtn.addEventListener('click', function () {
rows.forEach(function (r) { if (r.querySelector('input').checked) r.classList.remove('unread'); });
});
})();
(function initMailFolders() {
var nav = document.getElementById('mailFolders');
var title = document.getElementById('mailTitle');
if (!nav) return;
nav.addEventListener('click', function (e) {
var btn = e.target.closest('[data-folder]');
if (!btn) return;
nav.querySelectorAll('.nav-link').forEach(function (b) {
b.classList.remove('active');
b.removeAttribute('aria-current');
});
btn.classList.add('active');
btn.setAttribute('aria-current', 'page');
if (title) title.textContent = btn.getAttribute('data-folder');
});
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.