Bootstrap 5 Product Page Carousel with Size Selector
A product detail card with a two-product carousel, size picker that updates the price, wishlist toggle, star rating and add-to-cart button.
<section class="wdw-stage">
<div class="container" style="max-width:960px">
<div id="pdpCarousel" class="carousel slide wdw-card overflow-hidden" data-bs-ride="false" aria-roledescription="carousel" aria-label="Featured products">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row g-0 align-items-stretch">
<div class="col-md-5"><img class="pdp-img" src="https://images.unsplash.com/photo-1556228720-195a672e8a03?auto=format&fit=crop&w=800&q=80" alt="Herbalism Cleanser tube on a neutral background" loading="lazy"></div>
<div class="col-md-7 p-4 p-lg-5 d-flex flex-column">
<nav aria-label="breadcrumb"><ol class="breadcrumb small mb-3"><li class="breadcrumb-item"><a href="#">Home</a></li><li class="breadcrumb-item"><a href="#">Skincare</a></li><li class="breadcrumb-item active" aria-current="page">Cleansers</li></ol></nav>
<div class="d-flex justify-content-between align-items-start gap-3">
<div><h2 class="wdw-heading h2 mb-1">Herbalism Cleanser</h2><p class="wdw-muted mb-2">Natural herbal face wash with chamomile and oat</p></div>
<button type="button" class="btn btn-outline-secondary rounded-circle p-0 flex-none wish" style="width:44px" aria-pressed="false" aria-label="Save Herbalism Cleanser to wishlist"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><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 21.2l7.8-7.7 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg></button>
</div>
<div class="d-flex align-items-center gap-2 mb-4 small"><span class="text-warning d-inline-flex" role="img" aria-label="4.5 out of 5 stars"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg></span><span class="wdw-muted">1,590 reviews</span></div>
<div class="wdw-eyebrow mb-2">Size</div>
<div class="d-flex gap-2 mb-4"><input type="radio" class="btn-check" name="s1" id="s1-0" data-price="12.95" autocomplete="off" checked>
<label class="size-opt" for="s1-0"><span class="fw-bold">1.5 oz</span><span class="small">$12.95</span></label>
<input type="radio" class="btn-check" name="s1" id="s1-1" data-price="21.95" autocomplete="off">
<label class="size-opt" for="s1-1"><span class="fw-bold">4.4 oz</span><span class="small">$21.95</span></label>
</div>
<div class="mt-auto d-flex flex-wrap align-items-center justify-content-between gap-3">
<div><div class="small wdw-muted">Total</div><div class="fs-3 fw-bold text-body-emphasis">$<span class="js-price">12.95</span></div></div>
<button type="button" class="btn btn-primary rounded-pill px-4 add-cart">Add to cart</button>
</div>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row g-0 align-items-stretch">
<div class="col-md-5"><img class="pdp-img" src="https://images.unsplash.com/photo-1620916566398-39f1143ab7be?auto=format&fit=crop&w=800&q=80" alt="Silk Body Lotion tube on a neutral background" loading="lazy"></div>
<div class="col-md-7 p-4 p-lg-5 d-flex flex-column">
<nav aria-label="breadcrumb"><ol class="breadcrumb small mb-3"><li class="breadcrumb-item"><a href="#">Home</a></li><li class="breadcrumb-item"><a href="#">Skincare</a></li><li class="breadcrumb-item active" aria-current="page">Moisturisers</li></ol></nav>
<div class="d-flex justify-content-between align-items-start gap-3">
<div><h2 class="wdw-heading h2 mb-1">Silk Body Lotion</h2><p class="wdw-muted mb-2">Fragrance-free emulsion for dry, sensitive skin</p></div>
<button type="button" class="btn btn-outline-secondary rounded-circle p-0 flex-none wish" style="width:44px" aria-pressed="false" aria-label="Save Silk Body Lotion to wishlist"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><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 21.2l7.8-7.7 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg></button>
</div>
<div class="d-flex align-items-center gap-2 mb-4 small"><span class="text-warning d-inline-flex" role="img" aria-label="4.5 out of 5 stars"><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"><path d="m12 2 3.1 6.3 6.9 1-5 4.9 1.2 6.9L12 17.8 5.8 21.1 7 14.2 2 9.3l6.9-1z"/></svg></span><span class="wdw-muted">842 reviews</span></div>
<div class="wdw-eyebrow mb-2">Size</div>
<div class="d-flex gap-2 mb-4"><input type="radio" class="btn-check" name="s2" id="s2-0" data-price="18.50" autocomplete="off" checked>
<label class="size-opt" for="s2-0"><span class="fw-bold">6 oz</span><span class="small">$18.50</span></label>
<input type="radio" class="btn-check" name="s2" id="s2-1" data-price="31.00" autocomplete="off">
<label class="size-opt" for="s2-1"><span class="fw-bold">13 oz</span><span class="small">$31.00</span></label>
</div>
<div class="mt-auto d-flex flex-wrap align-items-center justify-content-between gap-3">
<div><div class="small wdw-muted">Total</div><div class="fs-3 fw-bold text-body-emphasis">$<span class="js-price">18.50</span></div></div>
<button type="button" class="btn btn-primary rounded-pill px-4 add-cart">Add to cart</button>
</div>
</div>
</div>
</div>
</div>
<div class="pdp-controls d-flex align-items-center gap-2">
<button class="btn btn-light rounded-circle p-0 shadow-sm" style="width:44px" type="button" data-bs-target="#pdpCarousel" data-bs-slide="prev" aria-label="Previous product"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg></button>
<span class="small fw-semibold text-body-secondary px-2" id="pdpCount" aria-live="polite">1 / 2</span>
<button class="btn btn-light rounded-circle p-0 shadow-sm" style="width:44px" type="button" data-bs-target="#pdpCarousel" data-bs-slide="next" aria-label="Next product"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 6 6 6-6 6"/></svg></button>
</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 */
.pdp-img { width: 100%; height: 100%; min-height: 280px; max-height: 480px; object-fit: cover; display: block; background: var(--bs-tertiary-bg); }
@media (min-width: 768px) { .pdp-img { max-height: none; min-height: 460px; } }
.pdp-controls { position: absolute; left: 1rem; bottom: 1rem; z-index: 3; }
@media (min-width: 768px) { .pdp-controls { left: 1.25rem; bottom: 1.25rem; background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent); backdrop-filter: blur(6px); padding: .35rem; border-radius: 50rem; } .pdp-controls .btn { box-shadow: none !important; } }
@media (max-width: 767.98px) { .pdp-controls { position: static; padding: 0 1.5rem 1.5rem; justify-content: center; } }
.flex-none { flex: none; }
.size-opt { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 6rem; padding: .65rem 1rem; border: 1.5px solid var(--bs-border-color); border-radius: 1rem; cursor: pointer; color: var(--bs-body-color); transition: border-color .15s, background .15s; }
.size-opt:hover { border-color: var(--bs-secondary-color); }
.btn-check:checked + .size-opt { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.btn-check:focus-visible + .size-opt { outline: 3px solid var(--bs-focus-ring-color); outline-offset: 2px; }
.wish[aria-pressed="true"] { color: var(--bs-danger); border-color: var(--bs-danger); background: var(--bs-danger-bg-subtle); }
.wish[aria-pressed="true"] svg { fill: currentColor; }
.add-cart.is-added { --bs-btn-bg: var(--bs-success); --bs-btn-border-color: var(--bs-success); --bs-btn-hover-bg: var(--bs-success); --bs-btn-hover-border-color: var(--bs-success); --bs-btn-color: #fff; }
.breadcrumb { --bs-breadcrumb-divider-color: var(--bs-secondary-color); }
.breadcrumb a { text-decoration: none; }
function initProductCarousel() {
var el = document.getElementById('pdpCarousel');
if (!el) return;
var count = document.getElementById('pdpCount');
var total = el.querySelectorAll('.carousel-item').length;
el.addEventListener('slid.bs.carousel', function (e) {
if (count) count.textContent = (e.to + 1) + ' / ' + total;
});
}
function initSizePrice() {
document.querySelectorAll('#pdpCarousel .btn-check').forEach(function (r) {
r.addEventListener('change', function () {
var out = r.closest('.carousel-item').querySelector('.js-price');
if (out) out.textContent = r.dataset.price;
});
});
}
function initWishlist() {
document.querySelectorAll('#pdpCarousel .wish').forEach(function (b) {
b.addEventListener('click', function () {
b.setAttribute('aria-pressed', String(b.getAttribute('aria-pressed') !== 'true'));
});
});
}
function initAddToCart() {
document.querySelectorAll('#pdpCarousel .add-cart').forEach(function (b) {
b.addEventListener('click', function () {
b.classList.add('is-added');
b.textContent = 'Added to cart';
setTimeout(function () { b.classList.remove('is-added'); b.textContent = 'Add to cart'; }, 1600);
});
});
}
initProductCarousel(); initSizePrice(); initWishlist(); initAddToCart();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.