Bootstrap 5 Hero Carousel with Search Bar
A full-width fading photo carousel with a headline and a floating search card for pickup city, drop-off city and vehicle type.
<section class="rs-hero position-relative">
<div id="heroCarousel" class="carousel slide carousel-fade h-100" data-bs-theme="dark" data-bs-interval="5000" aria-roledescription="carousel" aria-label="Featured destinations">
<div class="carousel-indicators rs-ind"><button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button><button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="1" aria-label="Slide 2"></button><button type="button" data-bs-target="#heroCarousel" data-bs-slide-to="2" aria-label="Slide 3"></button></div>
<button type="button" class="rs-pause" id="rsPause" aria-label="Pause slideshow" aria-pressed="false"><svg class="i-pause" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></svg><svg class="i-play" width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 5.5v13a1 1 0 0 0 1.5.9l10-6.5a1 1 0 0 0 0-1.8l-10-6.5A1 1 0 0 0 8 5.5z"/></svg></button>
<div class="carousel-inner h-100">
<div class="carousel-item active h-100" role="group" aria-roledescription="slide" aria-label="1 of 3">
<img src="https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?auto=format&fit=crop&w=1600&q=75" class="d-block w-100 h-100 object-fit-cover" alt="Yellow camper van driving along a desert road past red rock formations">
<div class="rs-scrim"></div>
<div class="carousel-caption text-start rs-caption">
<span class="badge rounded-pill text-bg-light mb-3">Rides & rentals</span>
<h1 class="display-4 fw-bolder mb-2">Road trips, sorted</h1>
<p class="fs-5 mb-0">Pick up in one city, drop off in another.</p>
</div>
</div>
<div class="carousel-item h-100" role="group" aria-roledescription="slide" aria-label="2 of 3">
<img src="https://images.unsplash.com/photo-1476514525535-07fb3b4ae5f1?auto=format&fit=crop&w=1600&q=75" class="d-block w-100 h-100 object-fit-cover" alt="Wooden boat bow on a turquoise alpine lake with mountains behind">
<div class="rs-scrim"></div>
<div class="carousel-caption text-start rs-caption">
<span class="badge rounded-pill text-bg-light mb-3">Rides & rentals</span>
<h2 class="display-4 fw-bolder mb-2">Weekend escapes</h2>
<p class="fs-5 mb-0">Cars, vans and campers ready when you are.</p>
</div>
</div>
<div class="carousel-item h-100" role="group" aria-roledescription="slide" aria-label="3 of 3">
<img src="https://images.unsplash.com/photo-1494783367193-149034c05e8f?auto=format&fit=crop&w=1600&q=75" class="d-block w-100 h-100 object-fit-cover" alt="Empty straight highway under a bright blue sky with mountains in the distance">
<div class="rs-scrim"></div>
<div class="carousel-caption text-start rs-caption">
<span class="badge rounded-pill text-bg-light mb-3">Rides & rentals</span>
<h2 class="display-4 fw-bolder mb-2">Open road ahead</h2>
<p class="fs-5 mb-0">Free cancellation on every booking.</p>
</div>
</div>
</div>
<button class="carousel-control-prev rs-ctrl" type="button" data-bs-target="#heroCarousel" data-bs-slide="prev"><span class="rs-arrow"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></span><span class="visually-hidden">Previous</span></button>
<button class="carousel-control-next rs-ctrl" type="button" data-bs-target="#heroCarousel" data-bs-slide="next"><span class="rs-arrow"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></span><span class="visually-hidden">Next</span></button>
</div>
<div class="rs-search container">
<form class="wdw-card p-3 p-lg-4" id="rideSearch" role="search" onsubmit="return false">
<div class="row g-3 align-items-end">
<div class="col-lg-3 col-md-6">
<label for="pickup" class="form-label small fw-semibold wdw-muted">Pickup city</label>
<input id="pickup" class="form-control" type="text" placeholder="City or airport" autocomplete="off">
</div>
<div class="col-lg-3 col-md-6">
<label for="drop" class="form-label small fw-semibold wdw-muted">Drop-off city</label>
<input id="drop" class="form-control" type="text" placeholder="City or airport" autocomplete="off">
</div>
<div class="col-lg-3 col-md-6">
<label for="vehicle" class="form-label small fw-semibold wdw-muted">Vehicle</label>
<select id="vehicle" class="form-select">
<option selected>Any vehicle</option><option>Compact car</option><option>SUV</option><option>Camper van</option><option>Electric</option><option>Minibus</option>
</select>
</div>
<div class="col-lg-3 col-md-6">
<button type="submit" class="btn btn-primary rounded-pill w-100">
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>Search
</button>
</div>
</div>
<p class="small wdw-muted mt-3 mb-0" id="rideStatus" role="status" aria-live="polite">Free cancellation up to 24 hours before pickup.</p>
</form>
</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 */
.rs-hero { min-height: 100vh; background: #1e1b4b; overflow: hidden; }
.rs-hero .carousel { position: absolute; inset: 0; }
.rs-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(15,12,45,.82) 0%, rgba(15,12,45,.5) 55%, rgba(15,12,45,.12) 100%), linear-gradient(180deg, rgba(15,12,45,.55), transparent 50%), linear-gradient(0deg, rgba(15,12,45,.55), transparent 45%); }
.rs-caption { left: max(1.5rem, calc((100% - 1140px) / 2 + .75rem)); right: auto; bottom: auto; top: 22%; max-width: 560px; padding: 0; z-index: 2; }
.rs-caption h1, .rs-caption h2 { letter-spacing: -.03em; text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.rs-search { position: absolute; left: 0; right: 0; bottom: 3rem; z-index: 5; max-width: 1040px; }
.rs-ctrl { width: 4.5rem; z-index: 4; opacity: 1; }
.rs-arrow { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.18); backdrop-filter: blur(6px); color: #fff; border: 1px solid rgba(255,255,255,.3); transition: background .2s; }
.rs-ctrl:hover .rs-arrow, .rs-ctrl:focus-visible .rs-arrow { background: rgba(255,255,255,.35); }
.rs-ind { z-index: 6; bottom: auto; top: 1.5rem; justify-content: flex-end; margin: 0 2rem 0 0; }
.rs-ind [data-bs-target] { box-sizing: content-box; width: 28px; height: 4px; margin-inline: 0; padding: 0; border: 0; border-block: 20px solid transparent; border-inline: 8px solid transparent; background-clip: padding-box; border-radius: 0; }
.rs-pause { position: absolute; z-index: 7; top: 1.5rem; right: 1.5rem; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); background: rgba(15,12,45,.45); color: #fff; backdrop-filter: blur(6px); }
.rs-pause:hover { background: rgba(15,12,45,.7); }
.rs-pause:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rs-pause .i-play, .rs-pause[aria-pressed="true"] .i-pause { display: none; }
.rs-pause[aria-pressed="true"] .i-play { display: block; }
@media (max-width: 991.98px) {
.rs-hero { min-height: 0; background: var(--wdw-stage); }
.rs-hero .carousel { position: relative; inset: auto; height: 360px !important; }
.rs-caption { top: 18%; }
.rs-caption h1, .rs-caption h2 { font-size: 2rem; }
.rs-caption p { font-size: 1rem !important; }
.rs-search { position: relative; bottom: auto; margin-top: -3rem; padding-bottom: 2rem; }
.rs-ctrl { width: 3.25rem; top: auto; bottom: 4.5rem; height: 44px; }
.rs-ind { margin-right: 4.5rem; top: .75rem; }
.rs-pause { top: 1rem; right: 1rem; }
}
@media (min-width: 992px) { .rs-ind { margin-right: 5.5rem; top: 1.1rem; } }
.rs-caption, .rs-caption h1, .rs-caption h2 { color: #fff; }
.rs-hero .carousel[data-bs-theme] { --bs-carousel-indicator-active-bg: #fff; color: #fff; }
.rs-hero .carousel[data-bs-theme] .rs-ctrl { filter: none; color: #fff; }
.rs-hero .carousel[data-bs-theme] .rs-ind [data-bs-target] { background-color: #fff; }
(function () {
function initRideSearch() {
const form = document.getElementById('rideSearch');
if (!form) return;
const status = form.querySelector('#rideStatus');
form.addEventListener('submit', () => {
const from = form.querySelector('#pickup').value.trim();
const to = form.querySelector('#drop').value.trim();
const v = form.querySelector('#vehicle').value.toLowerCase();
status.textContent = from && to ? 'Looking for ' + v + ' options from ' + from + ' to ' + to + '…' : 'Enter both a pickup and a drop-off city.';
});
}
function initHeroCarousel() {
const el = document.getElementById('heroCarousel');
const btn = document.getElementById('rsPause');
if (!el || !btn || !window.bootstrap) return;
const carousel = bootstrap.Carousel.getOrCreateInstance(el, { interval: 5000, ride: false, pause: false });
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const set = playing => {
btn.setAttribute('aria-pressed', String(!playing));
btn.setAttribute('aria-label', playing ? 'Pause slideshow' : 'Play slideshow');
el.querySelector('.carousel-inner').setAttribute('aria-live', playing ? 'off' : 'polite');
playing ? carousel.cycle() : carousel.pause();
};
btn.addEventListener('click', () => set(btn.getAttribute('aria-pressed') === 'true'));
set(!reduce);
}
initHeroCarousel();
initRideSearch();
})();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.