Snippets Calendar

Bootstrap 5 Date Range Picker with Click and Drag

A date range picker where you click and drag across a month grid to choose check-in and check-out dates, with a live summary of nights and total.

Bootstrap 5 No jQuery Feb 2020 3.3K views

<section class="wdw-stage">
  <div class="container" style="max-width:860px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-md-7 p-4 p-md-5">
          <div class="d-flex align-items-center justify-content-between mb-4">
            <div>
              <span class="wdw-eyebrow">Select dates</span>
              <h2 class="wdw-heading h4 mb-0" id="wdwMonthLabel" aria-live="polite">Month</h2>
            </div>
            <div class="d-flex gap-2">
              <button type="button" class="btn btn-outline-secondary rounded-circle p-0 wdw-nav" id="wdwPrev" aria-label="Previous month">
                <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="m15 6-6 6 6 6"/></svg>
              </button>
              <button type="button" class="btn btn-outline-secondary rounded-circle p-0 wdw-nav" id="wdwNext" aria-label="Next month">
                <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="m9 6 6 6-6 6"/></svg>
              </button>
            </div>
          </div>
          <div class="wdw-cal-week" aria-hidden="true">
            <span>Mon</span><span>Tue</span><span>Wed</span><span>Thu</span><span>Fri</span><span>Sat</span><span>Sun</span>
          </div>
          <div class="wdw-cal" id="wdwCal" role="group" aria-label="Calendar"></div>
          <p class="small wdw-muted mt-3 mb-0">Click and drag across days, or click a start and an end date.</p>
        </div>
        <div class="col-md-5 wdw-aurora p-4 p-md-5 d-flex flex-column">
          <p class="small text-uppercase fw-bold text-white-50 mb-4" style="letter-spacing:.08em">Your stay</p>
          <div class="d-flex flex-column gap-3 mb-4">
            <div>
              <p class="small text-white-50 mb-0">Check-in</p>
              <p class="h4 fw-bold mb-0" id="wdwFrom">Select a date</p>
            </div>
            <div>
              <p class="small text-white-50 mb-0">Check-out</p>
              <p class="h4 fw-bold mb-0" id="wdwTo">Select a date</p>
            </div>
          </div>
          <div class="rounded-4 p-3 mb-4 wdw-sum">
            <div class="d-flex justify-content-between small mb-1"><span class="text-white-50" id="wdwNights">0 nights</span><span class="text-white-50">$142 / night</span></div>
            <div class="d-flex justify-content-between align-items-baseline"><span>Total</span><span class="h4 fw-bold mb-0" id="wdwTotal">$0</span></div>
          </div>
          <div class="mt-auto d-grid gap-2">
            <button type="button" class="btn btn-light rounded-pill" id="wdwConfirm">Reserve these dates</button>
            <button type="button" class="btn btn-link link-light link-underline-opacity-0" id="wdwClear">Clear selection</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.