Snippets Form

Bootstrap 5 Survey Form with Rating Scale

A compact two-column survey form with required fields, a 1 to 10 recommendation scale, selectable improvement chips and a free-text comment box.

Bootstrap 5 No jQuery May 2019 2.1K views

<section class="wdw-stage">
  <div class="container" style="max-width:860px">
    <form id="surveyForm" class="wdw-card overflow-hidden" novalidate>
      <header class="wdw-aurora px-4 px-md-5 py-4">
        <div class="d-flex flex-wrap justify-content-between align-items-end gap-2 mb-3">
          <div>
            <span class="wdw-eyebrow text-white-50 mb-1">2 minute survey</span>
            <h1 class="h3 fw-bold text-white mb-0">Help us improve the platform</h1>
          </div>
          <span class="small text-white-50" id="svCount" aria-live="polite">0 of 4 required answered</span>
        </div>
        <div class="progress bg-white bg-opacity-25" style="height:6px" role="progressbar" aria-label="Survey progress" aria-valuemin="0" aria-valuemax="4" aria-valuenow="0" id="svBar"><div class="progress-bar bg-white" style="width:0"></div></div>
      </header>

      <div class="p-4 p-md-5">
      <div class="row g-3">
        <div class="col-md-6">
          <label for="svName" class="form-label fw-semibold">Name <span class="text-danger">*</span></label>
          <input type="text" class="form-control" id="svName" placeholder="Enter your name" autocomplete="name" required aria-describedby="svNameErr">
          <div class="invalid-feedback" id="svNameErr">Please enter your name.</div>
        </div>
        <div class="col-md-6">
          <label for="svEmail" class="form-label fw-semibold">Email <span class="text-danger">*</span></label>
          <input type="email" class="form-control" id="svEmail" placeholder="[email protected]" autocomplete="email" required aria-describedby="svEmailErr">
          <div class="invalid-feedback" id="svEmailErr">Enter a valid email.</div>
        </div>
        <div class="col-md-4">
          <label for="svAge" class="form-label fw-semibold">Age <span class="text-danger">*</span></label>
          <input type="number" class="form-control" id="svAge" min="1" max="125" placeholder="Age" required aria-describedby="svAgeErr">
          <div class="invalid-feedback" id="svAgeErr">Enter an age from 1 to 125.</div>
        </div>
        <div class="col-md-4 col-6">
          <label for="svRole" class="form-label fw-semibold">Current role</label>
          <select class="form-select" id="svRole"><option value="" selected disabled>Select</option><option>Student</option><option>Full-time job</option><option>Full-time learner</option><option>Prefer not to say</option><option>Other</option></select>
        </div>
        <div class="col-md-4 col-6">
          <label for="svLike" class="form-label fw-semibold">Like most</label>
          <select class="form-select" id="svLike"><option value="" selected disabled>Select</option><option>Challenges</option><option>Projects</option><option>Community</option><option>Open source</option></select>
        </div>

        <div class="col-12">
          <fieldset aria-required="true" id="svNpsSet">
            <legend class="form-label fw-semibold fs-6">How likely are you to recommend us to a friend or colleague? <span class="text-danger">*</span></legend>
            <div class="nps-grid" id="svNps"><input type="radio" class="btn-check" name="rating" id="nps1" value="1" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps1">1</label><input type="radio" class="btn-check" name="rating" id="nps2" value="2" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps2">2</label><input type="radio" class="btn-check" name="rating" id="nps3" value="3" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps3">3</label><input type="radio" class="btn-check" name="rating" id="nps4" value="4" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps4">4</label><input type="radio" class="btn-check" name="rating" id="nps5" value="5" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps5">5</label><input type="radio" class="btn-check" name="rating" id="nps6" value="6" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps6">6</label><input type="radio" class="btn-check" name="rating" id="nps7" value="7" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps7">7</label><input type="radio" class="btn-check" name="rating" id="nps8" value="8" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps8">8</label><input type="radio" class="btn-check" name="rating" id="nps9" value="9" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps9">9</label><input type="radio" class="btn-check" name="rating" id="nps10" value="10" required aria-describedby="svNpsErr"><label class="nps-btn" for="nps10">10</label></div>
            <div class="d-flex justify-content-between small wdw-muted mt-2"><span>Not likely</span><span>Very likely</span></div>
            <div class="small text-danger d-none mt-1" id="svNpsErr" tabindex="-1">Please pick a score from 1 to 10.</div>
          </fieldset>
        </div>

        <div class="col-12">
          <fieldset>
            <legend class="form-label fw-semibold fs-6">What should we improve? <span class="fw-normal wdw-muted">Select all that apply</span></legend>
            <div class="d-flex flex-wrap gap-2"><input type="checkbox" class="btn-check" name="improve" id="imp0" value="Front-end projects"><label class="survey-chip" for="imp0"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Front-end projects</label><input type="checkbox" class="btn-check" name="improve" id="imp1" value="Back-end projects"><label class="survey-chip" for="imp1"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Back-end projects</label><input type="checkbox" class="btn-check" name="improve" id="imp2" value="Data visualization"><label class="survey-chip" for="imp2"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Data visualization</label><input type="checkbox" class="btn-check" name="improve" id="imp3" value="Challenges"><label class="survey-chip" for="imp3"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Challenges</label><input type="checkbox" class="btn-check" name="improve" id="imp4" value="Open source community"><label class="survey-chip" for="imp4"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Open source community</label><input type="checkbox" class="btn-check" name="improve" id="imp5" value="Helper rooms"><label class="survey-chip" for="imp5"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Helper rooms</label><input type="checkbox" class="btn-check" name="improve" id="imp6" value="Meetups"><label class="survey-chip" for="imp6"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Meetups</label><input type="checkbox" class="btn-check" name="improve" id="imp7" value="Wiki"><label class="survey-chip" for="imp7"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Wiki</label><input type="checkbox" class="btn-check" name="improve" id="imp8" value="Forum"><label class="survey-chip" for="imp8"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Forum</label><input type="checkbox" class="btn-check" name="improve" id="imp9" value="Additional courses"><label class="survey-chip" for="imp9"><svg class="chip-ck" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>Additional courses</label></div>
          </fieldset>
        </div>

        <div class="col-12">
          <label for="svComment" class="form-label fw-semibold">Any comment or suggestion?</label>
          <textarea class="form-control" id="svComment" rows="2" placeholder="Enter your comment here..."></textarea>
        </div>
        <div class="col-12 d-flex flex-wrap align-items-center gap-3">
          <button type="submit" class="btn btn-primary rounded-pill px-4">Submit survey</button>
          <span id="svOk" class="text-success fw-semibold d-none" role="status">Thank you, your answers were sent.</span>
        </div>
      </div>
      </div>
    </form>
  </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.