Snippets Bar

Bootstrap 5 Rating Scale 1 to 10

A 1-to-10 rating scale with hover preview, a live score readout and a submit button, built on accessible radio inputs.

Bootstrap 5 No jQuery May 2020 5K views

<section class="wdw-stage">
  <div class="container" style="max-width:720px">
    <div class="wdw-card p-4 p-md-5 text-center" id="rater">
      <span class="wdw-icon mb-3" aria-hidden="true">
        <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3z"/></svg>
      </span>
      <h1 class="wdw-heading h3 mb-2">How would you rate your experience?</h1>
      <p class="wdw-muted mb-4">Choose a score from 1 to 10. Your feedback helps us improve.</p>

      <fieldset>
        <legend class="visually-hidden">Rating from 1 to 10</legend>
        <div class="rate-scale d-flex gap-1 gap-sm-2 justify-content-center" data-scale></div>
      </fieldset>
      <div class="d-flex justify-content-between small text-body-secondary mt-2 px-1"><span>Not great</span><span>Excellent</span></div>

      <div class="rate-readout mt-4" role="status" aria-live="polite">
        <span class="display-4 fw-bold text-primary lh-1" data-score>–</span><span class="fs-5 text-body-secondary">/10</span>
        <p class="fw-semibold mb-0 mt-1 text-body-emphasis" data-word>Tap a number to rate</p>
      </div>

      <button type="button" class="btn btn-primary rounded-pill px-5 mt-4" data-submit disabled>Submit rating</button>
    </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.