Snippets Contact form

Bootstrap 5 Sticky Contact Form Widget

A floating contact widget fixed to the bottom corner that opens into a compact message form with floating labels, closes with Escape and confirms on send.

Bootstrap 5 No jQuery May 2019 9.6K views

<section class="sc-section wdw-stage position-relative overflow-hidden">
  <div class="container py-4">
    <div class="row align-items-start g-5 w-100">
      <div class="col-lg-7">
        <span class="wdw-eyebrow mb-3">Acme Studio</span>
        <h1 class="display-5 wdw-heading mb-3">Websites that earn their keep.</h1>
        <p class="lead text-body-secondary mb-4">Strategy, design and development for ambitious small businesses. Questions? The chat in the corner is always one tap away.</p>
        <div class="d-flex gap-2 flex-wrap mb-5"><a href="#" class="btn btn-primary rounded-pill px-4">See our work</a><a href="#" class="btn btn-outline-secondary text-body rounded-pill px-4">Pricing</a></div>
        <div class="row g-3 text-body-secondary small">
          <div class="col-sm-4"><div class="fw-bold fs-3 text-body-emphasis">120+</div>Launches shipped</div>
          <div class="col-sm-4"><div class="fw-bold fs-3 text-body-emphasis">4.9/5</div>Client rating</div>
          <div class="col-sm-4"><div class="fw-bold fs-3 text-body-emphasis">2 weeks</div>Typical kickoff</div>
        </div>
      </div>
      <div class="col-lg-5 d-none d-lg-block">
        <div class="wdw-card-sm p-3 sc-showcase d-flex align-items-center gap-3" aria-hidden="true">
          <div class="wdw-aurora rounded-3 flex-shrink-0" style="width:72px;height:72px"></div>
          <div class="flex-grow-1"><div class="fw-semibold">Fieldly redesign</div><div class="small text-body-secondary">Launched in 6 weeks</div></div>
          <span class="badge rounded-pill bg-success-subtle text-success-emphasis">+38%</span>
        </div>
      </div>
    </div>
  </div>

  <div class="sc-widget" id="scWidget">
    <div class="sc-panel wdw-card overflow-hidden" id="scPanel" role="dialog" aria-labelledby="scTitle">
      <div class="wdw-aurora d-flex align-items-center gap-3 p-3">
        <img src="https://i.pravatar.cc/80?img=47" width="40" height="40" class="rounded-circle border border-2 border-white" alt="">
        <div class="flex-grow-1 lh-sm"><div class="fw-semibold" id="scTitle">Send us a message</div><div class="small" style="color:rgba(255,255,255,.8)">We usually reply in minutes</div></div>
        <button type="button" class="btn-close btn-close-white position-relative" id="scClose" aria-label="Close contact form"></button>
      </div>
      <form class="p-3 d-grid gap-2" id="scForm" novalidate>
        <div class="form-floating"><input type="text" class="form-control rounded-3" id="scName" placeholder="Name" required><label for="scName">Name</label></div>
        <div class="form-floating"><input type="email" class="form-control rounded-3" id="scEmail" placeholder="Email" required><label for="scEmail">Email</label></div>
        <div class="form-floating"><textarea class="form-control rounded-3" id="scMsg" placeholder="Message" style="height:90px" required></textarea><label for="scMsg">Message</label></div>
        <button type="submit" class="btn btn-primary rounded-pill">Send message</button>
        <div class="small text-success d-none text-center" id="scOk" role="status">Thanks! We'll be in touch soon.</div>
      </form>
    </div>
    <button type="button" class="sc-fab btn btn-primary rounded-circle shadow d-inline-flex align-items-center justify-content-center p-0" id="scToggle" aria-expanded="true" aria-controls="scPanel" aria-label="Open contact form">
      <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a8 8 0 0 1-11.6 7.1L3 21l1.9-6.4A8 8 0 1 1 21 12z"/></svg>
    </button>
  </div>
</section>

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

Free to use in personal and commercial projects under the MIT license.