Bootstrap 5 Email Inbox Message Layout
An email inbox layout with a folder sidebar, label chips and a message view that has a toolbar, sender header, attachments and a reply box.
<section class="wdw-stage">
<div class="container" style="max-width:1200px">
<div class="wdw-card mail overflow-hidden">
<div class="row g-0">
<aside class="col-lg-2 mail-side p-3 border-end">
<button type="button" class="btn btn-primary rounded-pill w-100 mb-3"><i class="bi bi-pencil-square"></i> New email</button>
<nav class="nav nav-pills flex-lg-column flex-row flex-nowrap gap-1 mail-folders overflow-auto pb-1 pb-lg-0" aria-label="Folders">
<a class="nav-link active d-flex align-items-center gap-2 flex-shrink-0" href="#" aria-current="page"><i class="bi bi-inbox"></i> Inbox <span class="badge rounded-pill ms-lg-auto text-bg-primary">4</span></a>
<a class="nav-link d-flex align-items-center gap-2 flex-shrink-0" href="#"><i class="bi bi-star"></i> Starred</a>
<a class="nav-link d-flex align-items-center gap-2 flex-shrink-0" href="#"><i class="bi bi-send"></i> Sent</a>
<a class="nav-link d-flex align-items-center gap-2 flex-shrink-0" href="#"><i class="bi bi-bookmark"></i> Important</a>
<a class="nav-link d-flex align-items-center gap-2 flex-shrink-0" href="#"><i class="bi bi-trash3"></i> Trash</a>
</nav>
<p class="wdw-eyebrow mt-4 mb-2 d-none d-lg-block">Labels</p>
<div class="d-none d-lg-flex flex-column gap-2 small">
<span class="d-flex align-items-center gap-2"><i class="ldot" style="--c:#ef4444"></i>Home</span>
<span class="d-flex align-items-center gap-2"><i class="ldot" style="--c:#0ea5e9"></i>Job</span>
<span class="d-flex align-items-center gap-2"><i class="ldot" style="--c:#22c55e"></i>Clients</span>
<span class="d-flex align-items-center gap-2"><i class="ldot" style="--c:#f59e0b"></i>News</span>
</div>
</aside>
<div class="col-lg-4 border-end mail-list">
<div class="px-3 py-3 border-bottom d-flex align-items-center">
<h2 class="h6 mb-0 fw-bold">Inbox</h2><small class="ms-auto text-body-secondary">4 unread</small>
</div>
<div class="list-group list-group-flush" id="mailList" role="listbox" aria-label="Messages">
<button type="button" class="list-group-item list-group-item-action mail-row active" role="option" aria-selected="true" data-from="Lukasz Holeczek" data-email="[email protected]" data-time="Today, 3:47 PM" data-subject="Quarterly planning: draft roadmap and next steps" data-body="Hi team, attached is the first draft of the roadmap for next quarter. Please skim the priorities and flag anything that feels off before Thursday's review." data-img="12">
<div class="d-flex align-items-center gap-2"><i class="udot"></i><span class="fw-semibold">Lukasz Holeczek</span><small class="ms-auto text-body-secondary">3:47 PM</small></div>
<div class="small fw-semibold text-truncate">Quarterly planning: draft roadmap</div>
<div class="small text-body-secondary text-truncate">Hi team, attached is the first draft…</div>
</button>
<button type="button" class="list-group-item list-group-item-action mail-row" role="option" aria-selected="false" data-from="Maya Patel" data-email="[email protected]" data-time="Today, 1:12 PM" data-subject="Invoice #2041 is ready for review" data-body="Hello, the invoice for September is ready. Let me know if the line items look right and I will send it over to accounting this afternoon." data-img="47">
<div class="d-flex align-items-center gap-2"><i class="udot"></i><span class="fw-semibold">Maya Patel</span><small class="ms-auto text-body-secondary">1:12 PM</small></div>
<div class="small fw-semibold text-truncate">Invoice #2041 is ready for review</div>
<div class="small text-body-secondary text-truncate">Hello, the invoice for September…</div>
</button>
<button type="button" class="list-group-item list-group-item-action mail-row" role="option" aria-selected="false" data-from="Tomas Berg" data-email="[email protected]" data-time="Yesterday" data-subject="New brand assets for the launch page" data-body="Sharing the final logo pack and icon set. Everything is exported as SVG, and the colour guide is inside the readme." data-img="33">
<div class="d-flex align-items-center gap-2"><i class="udot"></i><span class="fw-semibold">Tomas Berg</span><small class="ms-auto text-body-secondary">Yesterday</small></div>
<div class="small fw-semibold text-truncate">New brand assets for the launch page</div>
<div class="small text-body-secondary text-truncate">Sharing the final logo pack and…</div>
</button>
<button type="button" class="list-group-item list-group-item-action mail-row read" role="option" aria-selected="false" data-from="Priya Nair" data-email="[email protected]" data-time="Mon" data-subject="Re: Feedback on the homepage draft" data-body="Thanks for the quick turnaround. The layout feels right, and we only have small copy tweaks that I will list in the shared document." data-img="45">
<div class="d-flex align-items-center gap-2"><i class="udot invisible"></i><span class="fw-semibold">Priya Nair</span><small class="ms-auto text-body-secondary">Mon</small></div>
<div class="small text-truncate">Re: Feedback on the homepage draft</div>
<div class="small text-body-secondary text-truncate">Thanks for the quick turnaround…</div>
</button>
</div>
</div>
<div class="col-lg-6 p-3 p-lg-4 d-flex flex-column">
<div class="d-flex flex-wrap align-items-center gap-1 mb-3">
<button type="button" class="btn btn-light tb" id="starBtn" aria-pressed="false" aria-label="Star"><i class="bi bi-star"></i></button>
<button type="button" class="btn btn-light tb" aria-label="Reply"><i class="bi bi-reply"></i></button>
<button type="button" class="btn btn-light tb" aria-label="Reply all"><i class="bi bi-reply-all"></i></button>
<button type="button" class="btn btn-light tb" aria-label="Forward"><i class="bi bi-forward"></i></button>
<button type="button" class="btn btn-light tb" aria-label="Delete"><i class="bi bi-trash3"></i></button>
<div class="dropdown ms-auto">
<button class="btn btn-light rounded-pill dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-tags"></i> Label</button>
<ul class="dropdown-menu dropdown-menu-end" id="labelMenu">
<li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-label="Home" data-c="#ef4444" aria-pressed="false"><i class="ldot" style="--c:#ef4444"></i>Home<i class="bi bi-check2 ms-auto invisible"></i></button></li>
<li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-label="Job" data-c="#0ea5e9" aria-pressed="false"><i class="ldot" style="--c:#0ea5e9"></i>Job<i class="bi bi-check2 ms-auto invisible"></i></button></li>
<li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-label="Clients" data-c="#22c55e" aria-pressed="false"><i class="ldot" style="--c:#22c55e"></i>Clients<i class="bi bi-check2 ms-auto invisible"></i></button></li>
<li><button type="button" class="dropdown-item d-flex align-items-center gap-2" data-label="News" data-c="#f59e0b" aria-pressed="false"><i class="ldot" style="--c:#f59e0b"></i>News<i class="bi bi-check2 ms-auto invisible"></i></button></li>
</ul>
</div>
</div>
<h2 class="h5 wdw-heading mb-2" id="mSubject">Quarterly planning: draft roadmap and next steps</h2>
<div class="d-flex flex-wrap gap-2 mb-3" id="mLabels" aria-live="polite"></div>
<div class="d-flex align-items-center gap-3 py-3 border-top border-bottom">
<img class="rounded-circle" width="44" height="44" id="mImg" src="https://i.pravatar.cc/88?img=12" alt="">
<div class="lh-sm">
<div class="fw-semibold" id="mFrom">Lukasz Holeczek</div>
<small class="text-body-secondary" id="mEmail">[email protected]</small>
</div>
<small class="ms-auto text-body-secondary text-end" id="mTime">Today, 3:47 PM</small>
</div>
<div class="py-3 text-body-secondary mail-body"><p class="mb-0" id="mBody">Hi team, attached is the first draft of the roadmap for next quarter. Please skim the priorities and flag anything that feels off before Thursday's review.</p></div>
<ul class="list-unstyled mb-3 d-flex flex-wrap gap-2">
<li class="attach d-flex align-items-center gap-2"><i class="bi bi-file-earmark-zip text-primary"></i><span class="fw-semibold small">bootstrap.zip</span><small class="text-body-secondary">2.5 MB</small></li>
<li class="attach d-flex align-items-center gap-2"><i class="bi bi-file-earmark-text text-primary"></i><span class="fw-semibold small">readme.txt</span><small class="text-body-secondary">7 KB</small></li>
</ul>
<form class="mt-auto" id="replyForm">
<label for="reply" class="visually-hidden">Reply</label>
<textarea id="reply" class="form-control mb-2" rows="2" placeholder="Click here to reply" style="min-height:0;height:auto"></textarea>
<div class="d-flex justify-content-end"><button class="btn btn-primary rounded-pill px-4" type="submit"><i class="bi bi-send"></i> Send</button></div>
</form>
</div>
</div>
</div>
</div>
</section>
@import url("https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css");
/* 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 */
.mail-side { background: var(--bs-tertiary-bg); }
.mail-folders .nav-link { border-radius: 999px; padding: .55rem .9rem; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.mail-folders .nav-link:not(.active):hover { background: var(--bs-secondary-bg); }
.mail-body p { line-height: 1.65; }
.attach { padding: .45rem .8rem; border: 1px solid var(--bs-border-color); border-radius: 999px; background: var(--bs-tertiary-bg); }
.ldot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); flex: none; }
.udot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--bs-primary); flex: none; }
.mail-row { padding: .85rem 1rem; text-align: left; --bs-list-group-active-bg: var(--bs-primary-bg-subtle); --bs-list-group-active-color: var(--bs-body-color); --bs-list-group-active-border-color: var(--bs-border-color); box-shadow: inset 3px 0 0 transparent; }
.mail-row.active { box-shadow: inset 3px 0 0 var(--bs-primary); }
.mail-row.read .udot { display: none; }
.tb { width: 44px; padding: 0; border: 0; background: transparent; color: var(--bs-secondary-color); }
.tb:hover { background: var(--bs-secondary-bg); color: var(--bs-emphasis-color); }
.tb i { font-size: 1.1rem; }
.mail-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bs-secondary-bg); }
#starBtn.on { color: #f59e0b; }
@media (max-width: 991.98px) { .mail-side, .mail-list { border-right: 0 !important; border-bottom: 1px solid var(--bs-border-color); } .mail-folders { scrollbar-width: none; } }
function initFolders() {
const links = document.querySelectorAll('.mail-folders .nav-link');
links.forEach((a) => a.addEventListener('click', (e) => {
e.preventDefault();
links.forEach((l) => { l.classList.remove('active'); l.removeAttribute('aria-current'); });
a.classList.add('active');
a.setAttribute('aria-current', 'page');
}));
}
function initMessages() {
const rows = document.querySelectorAll('.mail-row');
rows.forEach((row) => row.addEventListener('click', () => {
rows.forEach((r) => { r.classList.remove('active'); r.setAttribute('aria-selected', 'false'); });
row.classList.add('active');
row.setAttribute('aria-selected', 'true');
row.classList.remove('read');
const u = row.querySelector('.udot'); if (u) u.classList.add('invisible');
const d = row.dataset;
document.getElementById('mSubject').textContent = d.subject;
document.getElementById('mFrom').textContent = d.from;
document.getElementById('mEmail').textContent = d.email;
document.getElementById('mTime').textContent = d.time;
document.getElementById('mBody').textContent = d.body;
document.getElementById('mImg').src = 'https://i.pravatar.cc/88?img=' + d.img;
document.querySelectorAll('#labelMenu [data-label]').forEach((b) => syncLabel(b, row));
renderLabels(row);
}));
}
const labelStore = new WeakMap();
function labelsOf(row) { if (!labelStore.has(row)) labelStore.set(row, new Map()); return labelStore.get(row); }
function syncLabel(btn, row) {
const on = labelsOf(row).has(btn.dataset.label);
btn.setAttribute('aria-pressed', on);
btn.querySelector('.bi-check2').classList.toggle('invisible', !on);
}
function renderLabels(row) {
const wrap = document.getElementById('mLabels');
wrap.textContent = '';
labelsOf(row).forEach((c, name) => {
const chip = document.createElement('span');
chip.className = 'mail-chip';
const dot = document.createElement('i');
dot.className = 'ldot'; dot.style.setProperty('--c', c);
chip.append(dot, name);
wrap.append(chip);
});
}
function initLabels() {
const menu = document.getElementById('labelMenu');
if (!menu) return;
menu.querySelectorAll('[data-label]').forEach((btn) => btn.addEventListener('click', () => {
const row = document.querySelector('.mail-row.active');
const map = labelsOf(row);
if (map.has(btn.dataset.label)) map.delete(btn.dataset.label); else map.set(btn.dataset.label, btn.dataset.c);
syncLabel(btn, row);
renderLabels(row);
}));
}
function initStar() {
const btn = document.getElementById('starBtn');
if (!btn) return;
btn.addEventListener('click', () => {
const on = btn.classList.toggle('on');
btn.setAttribute('aria-pressed', on);
btn.firstElementChild.className = on ? 'bi bi-star-fill' : 'bi bi-star';
});
}
function initReply() {
const form = document.getElementById('replyForm');
if (!form) return;
form.addEventListener('submit', (e) => { e.preventDefault(); form.reset(); });
}
initFolders(); initMessages(); initLabels(); initStar(); initReply();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.