Bootstrap 5 Checkout Form with Order Summary
A checkout layout pairing a product card and spec grid with an order summary, promo code field and payment form.
<section class="wdw-stage">
<div class="container" style="max-width:1080px">
<div class="row g-4 align-items-stretch">
<div class="col-lg-7">
<article class="wdw-card h-100 overflow-hidden d-flex flex-column">
<div class="position-relative">
<img src="https://images.unsplash.com/photo-1503376780353-7e6692767b70?auto=format&fit=crop&w=1200&q=80" alt="Black grand tourer driving on a highway at dusk" class="w-100 object-fit-cover" style="height:300px">
<span class="badge text-bg-light rounded-pill position-absolute top-0 start-0 m-3 px-3 py-2">Reservation</span>
</div>
<div class="p-4 p-md-4">
<h2 class="h4 fw-bold mb-1">Grand Tourer GT</h2>
<p class="wdw-muted mb-4">Hand-finished, delivered to your door and inspected before handover.</p>
<dl class="row row-cols-2 row-cols-sm-3 g-3 mb-0">
<div class="col"><dt class="small fw-normal wdw-muted">Mileage</dt><dd class="fw-semibold mb-0">100 km</dd></div>
<div class="col"><dt class="small fw-normal wdw-muted">Transmission</dt><dd class="fw-semibold mb-0">Automatic</dd></div>
<div class="col"><dt class="small fw-normal wdw-muted">Drive unit</dt><dd class="fw-semibold mb-0">Front</dd></div>
<div class="col"><dt class="small fw-normal wdw-muted">Body</dt><dd class="fw-semibold mb-0">Fastback</dd></div>
<div class="col"><dt class="small fw-normal wdw-muted">Colour</dt><dd class="fw-semibold mb-0">Black</dd></div>
<div class="col"><dt class="small fw-normal wdw-muted">Stock no.</dt><dd class="fw-semibold mb-0">#002</dd></div>
</dl>
</div>
</article>
</div>
<div class="col-lg-5">
<form class="wdw-card h-100 p-4 d-flex flex-column" id="checkoutForm" novalidate>
<div class="d-flex justify-content-between align-items-center mb-3">
<h2 class="h5 fw-bold mb-0">Order ZABHL90</h2>
<span class="badge bg-success-subtle text-success-emphasis rounded-pill"><i class="bi bi-lock-fill" aria-hidden="true"></i> Secure</span>
</div>
<dl class="mb-3">
<div class="d-flex justify-content-between mb-2"><dt class="fw-normal wdw-muted">Deposit</dt><dd class="mb-0 fw-semibold">$1,240</dd></div>
<div class="d-flex justify-content-between mb-2"><dt class="fw-normal wdw-muted">Shipping</dt><dd class="mb-0 fw-semibold text-success">Free</dd></div>
<div class="d-flex justify-content-between mb-2 d-none" id="promoRow"><dt class="fw-normal wdw-muted">Promo code</dt><dd class="mb-0 fw-semibold text-success">−$100</dd></div>
<div class="d-flex justify-content-between align-items-baseline pt-3 border-top"><dt>Total</dt><dd class="mb-0 fs-3 fw-bold" id="orderTotal" aria-live="polite">$1,240</dd></div>
</dl>
<div class="input-group mb-4">
<input type="text" class="form-control" id="promoInput" placeholder="Promo code (try SAVE100)" aria-label="Promo code">
<button type="button" class="btn btn-outline-primary" id="promoBtn">Apply</button>
</div>
<h3 class="h6 fw-bold mb-3">Payment details</h3>
<div class="form-floating mb-3"><input type="text" class="form-control" id="cardNum" inputmode="numeric" autocomplete="cc-number" placeholder="Card number" maxlength="19" required><label for="cardNum">Card number</label></div>
<div class="row g-3 mb-3">
<div class="col-6"><div class="form-floating"><input type="text" class="form-control" id="cardExp" inputmode="numeric" autocomplete="cc-exp" placeholder="MM/YY" maxlength="5" required><label for="cardExp">Expiry</label></div></div>
<div class="col-6"><div class="form-floating"><input type="text" class="form-control" id="cardCvc" inputmode="numeric" autocomplete="cc-csc" placeholder="CVC" maxlength="4" required><label for="cardCvc">CVC</label></div></div>
</div>
<div class="form-floating mb-4"><input type="text" class="form-control" id="cardName" autocomplete="cc-name" placeholder="Cardholder name" required><label for="cardName">Cardholder name</label></div>
<button type="submit" class="btn btn-primary btn-lg rounded-pill w-100 mt-auto">Purchase <i class="bi bi-arrow-right" aria-hidden="true"></i></button>
<p class="small text-success text-center mt-3 mb-0 d-none" id="checkoutDone" role="status">Thank you! Your reservation is confirmed.</p>
</form>
</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 */
dl{margin-bottom:0}
function initPromo() {
const btn = document.getElementById('promoBtn');
const input = document.getElementById('promoInput');
const row = document.getElementById('promoRow');
const total = document.getElementById('orderTotal');
if (!btn || !input || !row || !total) return;
btn.addEventListener('click', () => {
const ok = input.value.trim().toUpperCase() === 'SAVE100';
row.classList.toggle('d-none', !ok);
total.textContent = ok ? '$1,140' : '$1,240';
input.classList.toggle('is-valid', ok);
input.classList.toggle('is-invalid', !ok && input.value.trim() !== '');
});
}
function initCardFormat() {
const num = document.getElementById('cardNum');
const exp = document.getElementById('cardExp');
if (!num || !exp) return;
num.addEventListener('input', () => {
num.value = num.value.replace(/\D/g, '').slice(0, 16).replace(/(.{4})/g, '$1 ').trim();
});
exp.addEventListener('input', () => {
const d = exp.value.replace(/\D/g, '').slice(0, 4);
exp.value = d.length > 2 ? d.slice(0, 2) + '/' + d.slice(2) : d;
});
}
function initCheckoutSubmit() {
const form = document.getElementById('checkoutForm');
const done = document.getElementById('checkoutDone');
if (!form || !done) return;
form.addEventListener('submit', (e) => {
e.preventDefault();
form.classList.add('was-validated');
done.classList.toggle('d-none', !form.checkValidity());
});
}
initPromo();
initCardFormat();
initCheckoutSubmit();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.