Bootstrap 5 E-commerce Product Page with Image Carousel
A single product page with an image carousel and thumbnail strip, price and savings, finish swatches, add-to-cart actions and a seller card.
<section class="wdw-stage">
<div class="container" style="max-width:1080px">
<div class="wdw-card p-3 p-lg-4">
<div class="row g-4 g-lg-5">
<div class="col-lg-6">
<div id="prodCarousel" class="carousel slide" data-bs-ride="false" aria-label="Product images">
<div class="carousel-inner rounded-4 overflow-hidden"><div class="carousel-item active"><img src="https://images.unsplash.com/photo-1493663284031-b7e3aefcae8e?w=900&q=80" class="d-block w-100 prod-img" alt="Living room with a grey sofa and wooden table"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1503602642458-232111445657?w=900&q=80" class="d-block w-100 prod-img" alt="Lounge chair beside a window"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1540574163026-643ea20ade25?w=900&q=80" class="d-block w-100 prod-img" alt="Minimalist dining chairs"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1555041469-a586c61ea9bc?w=900&q=80" class="d-block w-100 prod-img" alt="Modern sofa with cushions"></div><div class="carousel-item"><img src="https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=900&q=80" class="d-block w-100 prod-img" alt="Bright reading corner"></div></div>
<button class="carousel-control-prev" type="button" data-bs-target="#prodCarousel" data-bs-slide="prev"><span class="prod-arrow"><span class="carousel-control-prev-icon" aria-hidden="true"></span></span><span class="visually-hidden">Previous</span></button>
<button class="carousel-control-next" type="button" data-bs-target="#prodCarousel" data-bs-slide="next"><span class="prod-arrow"><span class="carousel-control-next-icon" aria-hidden="true"></span></span><span class="visually-hidden">Next</span></button>
</div>
<div class="d-flex gap-2 mt-3 overflow-auto pb-1" id="prodThumbs"><button type="button" class="prod-thumb active" data-bs-target="#prodCarousel" data-bs-slide-to="0" aria-label="Show image 1" aria-current="true"><img src="https://images.unsplash.com/photo-1493663284031-b7e3aefcae8e?w=160&q=80" alt="" width="72" height="72"></button><button type="button" class="prod-thumb" data-bs-target="#prodCarousel" data-bs-slide-to="1" aria-label="Show image 2"><img src="https://images.unsplash.com/photo-1503602642458-232111445657?w=160&q=80" alt="" width="72" height="72"></button><button type="button" class="prod-thumb" data-bs-target="#prodCarousel" data-bs-slide-to="2" aria-label="Show image 3"><img src="https://images.unsplash.com/photo-1540574163026-643ea20ade25?w=160&q=80" alt="" width="72" height="72"></button><button type="button" class="prod-thumb" data-bs-target="#prodCarousel" data-bs-slide-to="3" aria-label="Show image 4"><img src="https://images.unsplash.com/photo-1555041469-a586c61ea9bc?w=160&q=80" alt="" width="72" height="72"></button><button type="button" class="prod-thumb" data-bs-target="#prodCarousel" data-bs-slide-to="4" aria-label="Show image 5"><img src="https://images.unsplash.com/photo-1586023492125-27b2c045efd7?w=160&q=80" alt="" width="72" height="72"></button></div>
</div>
<div class="col-lg-6 d-flex flex-column">
<div class="d-flex align-items-center gap-2 mb-2">
<span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">Bestseller</span>
<span class="small wdw-muted"><span class="text-warning" aria-hidden="true">★★★★★</span> 5.0 · 230 reviews</span>
</div>
<h2 class="wdw-heading h2 mb-1">Ypperlig Lounge Collection</h2>
<p class="wdw-muted mb-3">Designed in Stockholm with Hay</p>
<div class="d-flex align-items-baseline gap-2 mb-3"><span class="fs-2 fw-bold" id="price">$3,444</span><s class="wdw-muted">$3,990</s><span class="badge text-bg-success rounded-pill">Save 14%</span></div>
<p class="mb-4">High-strength clamps and joinery techniques give every piece a sturdy, creak-free build. Form and function at the same point, made for decades of use.</p>
<fieldset class="mb-4">
<legend class="small fw-semibold mb-2">Finish: <span id="finishName" class="fw-normal wdw-muted">Oak</span></legend>
<div class="d-flex gap-2" role="radiogroup">
<input type="radio" class="btn-check" name="finish" id="f1" value="Oak" checked><label class="prod-swatch" style="--sw:#c8a27a" for="f1"><span class="visually-hidden">Oak</span></label>
<input type="radio" class="btn-check" name="finish" id="f2" value="Walnut"><label class="prod-swatch" style="--sw:#5b3d2a" for="f2"><span class="visually-hidden">Walnut</span></label>
<input type="radio" class="btn-check" name="finish" id="f3" value="Ash grey"><label class="prod-swatch" style="--sw:#8c9199" for="f3"><span class="visually-hidden">Ash grey</span></label>
<input type="radio" class="btn-check" name="finish" id="f4" value="Charcoal"><label class="prod-swatch" style="--sw:#2b2d33" for="f4"><span class="visually-hidden">Charcoal</span></label>
</div>
</fieldset>
<div class="d-flex flex-wrap gap-2 mb-4">
<button type="button" class="btn btn-primary rounded-pill px-4 flex-grow-1" id="addCart">Add to cart</button>
<button type="button" class="btn btn-outline-primary rounded-pill px-4">Buy now</button>
<button type="button" class="btn btn-outline-secondary rounded-circle p-0 prod-fav" style="width:44px" aria-pressed="false" aria-label="Save to wishlist"><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="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1 1.1L12 21l7.8-7.5 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg></button>
</div>
<ul class="list-unstyled small mb-4 row row-cols-1 row-cols-sm-2 g-2">
<li class="col d-flex gap-2"><span class="text-primary">✓</span> Best in quality</li>
<li class="col d-flex gap-2"><span class="text-primary">✓</span> Anti-creak joinery</li>
<li class="col d-flex gap-2"><span class="text-primary">✓</span> Sturdy laminate surfaces</li>
<li class="col d-flex gap-2"><span class="text-primary">✓</span> Easy-access storage</li>
</ul>
<div class="mt-auto d-flex align-items-center gap-3 p-3 rounded-4 bg-body-tertiary">
<img src="https://i.pravatar.cc/90?img=15" class="rounded-circle" width="44" height="44" alt="">
<div class="lh-sm flex-grow-1"><strong class="d-block">Rare Boutique</strong><span class="small wdw-muted">Ships from Sweden in 15-45 days</span></div>
<a href="#" class="btn btn-sm btn-outline-primary rounded-pill">Visit</a>
</div>
</div>
</div>
</div>
</div>
<div class="toast-container position-fixed bottom-0 end-0 p-3"><div id="cartToast" class="toast text-bg-dark" role="status" aria-live="polite" aria-atomic="true"><div class="toast-body">Added to your cart.</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 */
.prod-img { aspect-ratio: 1 / 1; object-fit: cover; }
.prod-arrow { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(15,17,23,.55); }
.prod-arrow span { width: 1rem; height: 1rem; }
.prod-thumb { flex: none; padding: 0; border: 2px solid transparent; border-radius: .75rem; overflow: hidden; background: none; opacity: .6; transition: opacity .2s, border-color .2s; }
.prod-thumb img { display: block; object-fit: cover; }
.prod-thumb.active, .prod-thumb:hover { opacity: 1; border-color: var(--bs-primary); }
.prod-swatch { width: 44px; height: 44px; border-radius: 50%; background: var(--sw); cursor: pointer; border: 3px solid var(--bs-body-bg); box-shadow: 0 0 0 1px var(--bs-border-color); transition: box-shadow .15s; }
.btn-check:checked + .prod-swatch { box-shadow: 0 0 0 2px var(--bs-primary); }
.btn-check:focus-visible + .prod-swatch { box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color), 0 0 0 2px var(--bs-primary); }
.prod-fav[aria-pressed="true"] { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.prod-fav[aria-pressed="true"] svg { fill: currentColor; }
.carousel-control-prev, .carousel-control-next { opacity: 1; width: 4.5rem; }
function initProductGallery() {
const carousel = document.getElementById('prodCarousel');
const thumbs = document.querySelectorAll('.prod-thumb');
if (!carousel || !thumbs.length) return;
carousel.addEventListener('slid.bs.carousel', (e) => {
thumbs.forEach((t, i) => {
const on = i === e.to;
t.classList.toggle('active', on);
if (on) t.setAttribute('aria-current', 'true'); else t.removeAttribute('aria-current');
});
});
}
function initFinish() {
const label = document.getElementById('finishName');
if (!label) return;
document.querySelectorAll('input[name="finish"]').forEach((r) => {
r.addEventListener('change', () => { label.textContent = r.value; });
});
}
function initCartActions() {
const add = document.getElementById('addCart');
const toastEl = document.getElementById('cartToast');
const fav = document.querySelector('.prod-fav');
if (add && toastEl) {
const toast = new bootstrap.Toast(toastEl, { delay: 2200 });
add.addEventListener('click', () => toast.show());
}
if (fav) {
fav.addEventListener('click', () => {
fav.setAttribute('aria-pressed', fav.getAttribute('aria-pressed') !== 'true');
});
}
}
initProductGallery();
initFinish();
initCartActions();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.