Snippets Contact form

Bootstrap 5 Contact Form with Contact Details

A contact form with a brand panel for address, phone and email beside a floating-label form with project type and inline validation.

Bootstrap 5 No jQuery Feb 2020 3K 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-5 wdw-aurora p-4 p-lg-5 d-flex flex-column justify-content-between gap-5">
          <div>
            <span class="wdw-eyebrow" style="color:#c7d2fe">Contact us</span>
            <h2 class="fw-bold mt-2 mb-3">Let's start your next project</h2>
            <p class="mb-0 opacity-75">Tell us a little about what you're building and we'll reply within one business day.</p>
          </div>
          <ul class="list-unstyled d-grid gap-3 mb-0">
            <li class="d-flex align-items-center gap-3">
              <span class="wdw-contact-ic"><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="M20 10c0 6-8 12-8 12S4 16 4 10a8 8 0 1 1 16 0z"/><circle cx="12" cy="10" r="3"/></svg></span>
              <span>8266 Gygax Road, Norfolk, VA</span>
            </li>
            <li class="d-flex align-items-center gap-3">
              <span class="wdw-contact-ic"><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="M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8.1 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z"/></svg></span>
              <span>757 287 1608</span>
            </li>
            <li class="d-flex align-items-center gap-3">
              <span class="wdw-contact-ic"><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"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 6L2 7"/></svg></span>
              <span>[email protected]</span>
            </li>
          </ul>
        </div>
        <div class="col-lg-7 p-4 p-lg-5">
          <form id="contactForm" class="d-grid gap-3" novalidate>
            <div class="row g-3">
              <div class="col-sm-6 form-floating">
                <input type="text" class="form-control" id="cfName" placeholder="Name" required>
                <label for="cfName" class="ms-2">Name</label>
              </div>
              <div class="col-sm-6 form-floating">
                <input type="email" class="form-control" id="cfEmail" placeholder="Email" required>
                <label for="cfEmail" class="ms-2">Email</label>
              </div>
            </div>
            <div class="form-floating">
              <select class="form-select" id="cfType" aria-label="Project type">
                <option>Website design</option><option>Web app</option><option>Branding</option><option>Something else</option>
              </select>
              <label for="cfType">Project type</label>
            </div>
            <div class="form-floating">
              <textarea class="form-control cf-text" id="cfMsg" placeholder="Message" required></textarea>
              <label for="cfMsg">Tell us about your project</label>
            </div>
            <div class="invalid-feedback d-none" id="cfError">Please fill in your name, a valid email and a message.</div>
            <button type="submit" class="btn btn-primary rounded-pill px-4 align-self-start">Send message</button>
            <div class="alert alert-success d-none mb-0 rounded-4" id="cfOk" role="status">Thanks! Your message is on its way.</div>
          </form>
        </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.

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