Snippets

Bootstrap 5 Pagination with Ellipsis

Design notes, paged with a progress hint, category badges and a compact pill pager that stays on one row.

Bootstrap 5 No jQuery Jul 2019 2.5K views

<section class="wdw-stage">
  <div class="container" style="max-width:860px">
    <div class="wdw-card p-3 p-sm-4 p-md-5">
      <div class="d-flex flex-wrap align-items-end justify-content-between gap-3 mb-3">
        <div>
          <span class="wdw-eyebrow">Journal</span>
          <h2 class="wdw-heading h3 mt-1 mb-1">Design notes</h2>
          <p class="wdw-muted small mb-0" id="pgInfo" aria-live="polite">Showing entries 41–50 of 240</p>
        </div>
        <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis fs-6 px-3 py-2" id="pgBadge">Page 5 of 24</span>
      </div>
      <div class="progress mb-4" style="height:6px" role="progressbar" aria-label="Page progress" aria-valuemin="1" aria-valuemax="24" aria-valuenow="5" id="pgBar">
        <div class="progress-bar rounded-pill" id="pgFill" style="width:20.8%"></div>
      </div>
      <ul class="list-unstyled wdw-list mb-4" id="pgList"></ul>
      <nav aria-label="Article pages" class="d-flex justify-content-center">
        <ul class="pagination wdw-pager mb-0" id="pager"></ul>
      </nav>
    </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.