Snippets Bar

Bootstrap 5 Modal Review Form with Star Rating

A review summary card with rating breakdown that opens a modal where visitors pick a star rating, add a title and write a comment.

Bootstrap 5 No jQuery May 2020 3.1K views

<section class="wdw-stage">
  <div class="container" style="max-width: 980px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <div class="col-md-5 wdw-aurora p-4 p-md-5">
          <span class="wdw-eyebrow text-white-50">Customer reviews</span>
          <div class="d-flex align-items-end gap-3 mt-2 mb-3">
            <h2 class="display-1 fw-bold mb-0 lh-1"><span class="visually-hidden">Rated </span>4.8<span class="visually-hidden"> out of 5</span></h2>
            <div class="pb-1">
              <div class="wdw-stars d-flex gap-1" aria-hidden="true" id="summaryStars"></div>
              <small class="text-white-50">Based on 1,284 reviews</small>
            </div>
          </div>
          <span class="badge rounded-pill text-bg-light mb-4 px-3 py-2">96% would recommend</span>
          <div class="vstack gap-2 mb-4" id="ratingBars"></div>
          <figure class="mb-0 pt-3 border-top border-light border-opacity-25">
            <blockquote class="small mb-1">“Setup took ten minutes and support answered the same day.”</blockquote>
            <figcaption class="small text-white-50">Maya R., verified buyer</figcaption>
          </figure>
        </div>
        <div class="col-md-7 p-4 p-md-5">
          <form id="reviewForm" novalidate>
            <h3 class="h4 wdw-heading mb-1">How was your experience?</h3>
            <p class="wdw-muted small mb-4">Your feedback helps others choose with confidence.</p>
            <fieldset class="mb-4">
              <legend class="form-label fw-semibold fs-6">Your rating</legend>
              <div class="wdw-rate">
                <input type="radio" class="btn-check" name="rating" id="r5" value="5" required><label for="r5" title="5 stars"><span class="visually-hidden">5 stars</span></label>
                <input type="radio" class="btn-check" name="rating" id="r4" value="4"><label for="r4" title="4 stars"><span class="visually-hidden">4 stars</span></label>
                <input type="radio" class="btn-check" name="rating" id="r3" value="3"><label for="r3" title="3 stars"><span class="visually-hidden">3 stars</span></label>
                <input type="radio" class="btn-check" name="rating" id="r2" value="2"><label for="r2" title="2 stars"><span class="visually-hidden">2 stars</span></label>
                <input type="radio" class="btn-check" name="rating" id="r1" value="1"><label for="r1" title="1 star"><span class="visually-hidden">1 star</span></label>
              </div>
              <div class="invalid-feedback">Please choose a rating.</div>
            </fieldset>
            <div class="form-floating mb-3">
              <input type="text" class="form-control" id="reviewTitle" placeholder="Title" required>
              <label for="reviewTitle">Review title</label>
            </div>
            <div class="form-floating mb-4">
              <textarea class="form-control" id="reviewText" placeholder="Comment" style="height: 130px" required></textarea>
              <label for="reviewText">Tell us more</label>
            </div>
            <button type="submit" class="btn btn-primary rounded-pill px-4">Send review</button>
            <p class="text-success small fw-semibold mt-3 mb-0" id="reviewThanks" role="status"></p>
          </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.