Snippets Card

Bootstrap 5 Weather Card with Location Search

A weather dashboard with a large current-conditions hero, a location search with quick-pick cities, and a list of cloud, humidity, wind and rain details.

Bootstrap 5 No jQuery Dec 2019 3.1K views

<section class="wdw-stage">
  <div class="container" style="max-width:1000px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-lg-8">
          <div class="wdw-aurora h-100 p-4 p-md-5 d-flex flex-column wx-main">
            <div class="d-flex justify-content-between align-items-center">
              <span class="fw-semibold opacity-75">the.weather</span>
              <span class="badge rounded-pill text-bg-light" id="wxCond">Sunny</span>
            </div>
            <div class="text-center my-auto py-4"><svg width="120" height="120" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="wx-sun"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg></div>
            <div class="d-flex flex-wrap align-items-end gap-3 gap-md-4">
              <div class="wx-temp" aria-live="polite"><span id="wxTemp">26</span>°</div>
              <div class="pb-2">
                <h1 class="h2 fw-bold mb-0" id="wxCity">London</h1>
                <small class="opacity-75" id="wxTime">10:36 · Tuesday, 22 Oct</small>
              </div>
            </div>
          </div>
        </div>
        <div class="col-lg-4">
          <div class="p-4 p-md-4 h-100">
            <form id="wxSearch" role="search" class="mb-3">
              <label for="wxInput" class="visually-hidden">Search another location</label>
              <div class="input-group">
                <input type="search" class="form-control" id="wxInput" placeholder="Another location" autocomplete="off">
                <button class="btn btn-primary" type="submit" aria-label="Search">
                  <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"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
                </button>
              </div>
              <div class="small text-danger mt-1" id="wxErr" role="status"></div>
            </form>
            <div class="list-group gap-1 mb-4" id="wxCities"><button type="button" class="list-group-item list-group-item-action border-0 rounded-3 wx-city" data-city="Birmingham">Birmingham</button><button type="button" class="list-group-item list-group-item-action border-0 rounded-3 wx-city" data-city="Manchester">Manchester</button><button type="button" class="list-group-item list-group-item-action border-0 rounded-3 wx-city" data-city="New York">New York</button><button type="button" class="list-group-item list-group-item-action border-0 rounded-3 wx-city" data-city="California">California</button></div>
            <h2 class="wdw-eyebrow mb-1">Weather details</h2>
            <ul class="list-unstyled mb-0"><li class="d-flex justify-content-between py-2 border-bottom"><span class="wdw-muted">Cloud cover</span><strong id="wxCloud">-</strong></li><li class="d-flex justify-content-between py-2 border-bottom"><span class="wdw-muted">Humidity</span><strong id="wxHum">-</strong></li><li class="d-flex justify-content-between py-2 border-bottom"><span class="wdw-muted">Wind</span><strong id="wxWind">-</strong></li><li class="d-flex justify-content-between py-2 border-bottom"><span class="wdw-muted">Rain</span><strong id="wxRain">-</strong></li></ul>
          </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.