Bootstrap 5 Forum Thread List with Search and Pagination
A forum thread list with status badges, reply counts and last-activity avatars, plus live search, a New thread button and pagination. It collapses into a compact stacked layout on phones.
<section class="wdw-stage align-items-start align-items-md-center">
<div class="container" style="max-width:920px">
<div class="d-flex flex-wrap align-items-center justify-content-between gap-3 mb-4">
<div><span class="wdw-eyebrow">Community</span><h2 class="wdw-heading h3 mb-0 mt-1">General discussion</h2></div>
<div class="d-flex gap-2 flex-grow-1 flex-md-grow-0 forum-tools">
<label class="visually-hidden" for="forumSearch">Search threads</label>
<input type="search" id="forumSearch" class="form-control" placeholder="Search threads...">
<button type="button" class="btn btn-primary rounded-pill text-nowrap"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>New thread</button>
</div>
</div>
<div class="wdw-card overflow-hidden">
<div class="forum-head d-none d-md-grid px-4 py-3 border-bottom small fw-semibold wdw-muted text-uppercase"><span>Topic</span><span>Replies</span><span>Last update</span></div>
<ul class="list-unstyled m-0" id="forumList">
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">How can I change my username?</a>
<div class="small wdw-muted mt-1">Started 25 days ago · Neon Mandela</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">12</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=12" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">1 day ago</div><div class="wdw-muted">by Tim Cook</div></div></div>
</li>
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">How do I switch the theme to dark mode?</a><span class="badge rounded-pill text-bg-success ms-1 align-middle">Solved</span>
<div class="small wdw-muted mt-1">Started 5 days ago · Allize Rome</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">43</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=14" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">1 day ago</div><div class="wdw-muted">by Steve Smith</div></div></div>
</li>
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">Is it possible to get a refund for a product I purchased today?</a><span class="badge rounded-pill text-bg-secondary ms-1 align-middle">Locked</span>
<div class="small wdw-muted mt-1">Started 21 days ago · Kane William</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">42</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=32" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">2 days ago</div><div class="wdw-muted">by Brett Wilson</div></div></div>
</li>
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">Do you have an Android app for this tool?</a>
<div class="small wdw-muted mt-1">Started 56 days ago · Glen Maxwell</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">632</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=33" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">11 days ago</div><div class="wdw-muted">by Neil Patel</div></div></div>
</li>
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">How can I transfer my funds to a friend?</a><span class="badge rounded-pill text-bg-secondary ms-1 align-middle">Closed</span>
<div class="small wdw-muted mt-1">Started 25 days ago · Marry Tom</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">53</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=52" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">1 day ago</div><div class="wdw-muted">by Tibor Tom</div></div></div>
</li>
<li class="forum-row px-3 px-md-4 py-3 border-bottom">
<div ><a href="#" class="forum-title fw-semibold text-body-emphasis text-decoration-none">How do I delete my account?</a><span class="badge rounded-pill text-bg-danger ms-1 align-middle">Hot</span>
<div class="small wdw-muted mt-1">Started 25 days ago · Bob Bulmer</div></div>
<div class="forum-replies"><span class="fw-semibold text-body-emphasis">128</span><span class="d-md-none small wdw-muted"> replies</span></div>
<div class="d-flex align-items-center gap-2 forum-last"><img src="https://i.pravatar.cc/72?img=60" width="36" height="36" class="rounded-circle" alt="" loading="lazy"><div class="small lh-sm"><div class="text-body-emphasis">3 hours ago</div><div class="wdw-muted">by Ross Taylor</div></div></div>
</li>
</ul>
<p class="text-center wdw-muted py-5 m-0 d-none" id="forumEmpty">No threads match your search.</p>
</div>
<nav class="d-flex justify-content-center mt-4" aria-label="Thread pages"><ul class="pagination pagination-lg gap-1 mb-0">
<li class="page-item disabled"><a class="page-link rounded-circle" href="#" aria-label="Previous">«</a></li>
<li class="page-item active" aria-current="page"><a class="page-link rounded-circle" href="#">1</a></li>
<li class="page-item"><a class="page-link rounded-circle" href="#">2</a></li>
<li class="page-item"><a class="page-link rounded-circle" href="#">3</a></li>
<li class="page-item"><a class="page-link rounded-circle" href="#" aria-label="Next">»</a></li>
</ul></nav>
</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 */
.forum-head, .forum-row { grid-template-columns: minmax(0,1fr) 5rem 11rem; gap: 1rem; align-items: center; }
.forum-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .5rem 1rem; transition: background-color .15s; }
.forum-row:last-child { border-bottom: 0 !important; }
.forum-row:hover { background: var(--bs-tertiary-bg); }
.forum-title:hover { color: var(--bs-primary) !important; }
.forum-last { grid-column: 1 / -1; }
.forum-replies { grid-row: 1; grid-column: 2; }
.forum-tools .form-control { min-width: 0; }
.forum-tools .btn { flex: none; }
@media (min-width: 768px) {
.forum-head { display: grid; }
.forum-row { grid-template-columns: minmax(0,1fr) 5rem 11rem; gap: 1rem; }
.forum-last { grid-column: auto; }
.forum-replies { grid-row: auto; grid-column: auto; }
.forum-tools .form-control { width: 240px; }
}
.pagination .page-link { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; padding: 0; font-size: .95rem; font-weight: 600; border: 0; background: transparent; }
.pagination .page-link:hover { background: var(--bs-tertiary-bg); }
.pagination .active .page-link { background: var(--bs-primary); color: #fff; }
[data-bs-theme="dark"] .pagination .active .page-link { color: #0f1117; }
.pagination .disabled .page-link { background: transparent; opacity: .4; }
function initForumSearch() {
const input = document.getElementById('forumSearch');
const rows = document.querySelectorAll('#forumList .forum-row');
const empty = document.getElementById('forumEmpty');
if (!input || !empty) return;
input.addEventListener('input', () => {
const q = input.value.trim().toLowerCase();
let visible = 0;
rows.forEach((row) => {
const match = row.textContent.toLowerCase().includes(q);
row.classList.toggle('d-none', !match);
if (match) visible++;
});
empty.classList.toggle('d-none', visible > 0);
});
}
initForumSearch();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.