Snippets Data

Bootstrap 5 Orders Table with Search, Filter and Pagination

A customer orders table with live search, a status filter, a rows-per-page selector and numbered pagination. Status badges use colour for meaning and each row has an action button with a tooltip.

Bootstrap 5 No jQuery Sep 2020 2.1K views

<section class="wdw-stage">
  <div class="container" style="max-width:1000px">
    <div class="wdw-card overflow-hidden" id="orders">
      <div class="p-4 d-flex flex-wrap align-items-center justify-content-between gap-3 border-bottom">
        <div>
          <span class="wdw-eyebrow">Sales</span>
          <h2 class="wdw-heading h4 mb-0">Order details</h2>
        </div>
        <div class="d-flex gap-2">
          <button type="button" class="btn btn-outline-secondary text-body rounded-pill btn-sm px-3">Export</button>
          <button type="button" class="btn btn-primary rounded-pill btn-sm px-3" id="ordRefresh">Refresh</button>
        </div>
      </div>
      <div class="p-4 pb-3 row g-2">
        <div class="col-12 col-md-6">
          <label class="visually-hidden" for="ordSearch">Search customers</label>
          <input type="search" id="ordSearch" class="form-control" placeholder="Search customer or city">
        </div>
        <div class="col-6 col-md-3">
          <label class="visually-hidden" for="ordStatus">Status</label>
          <select id="ordStatus" class="form-select"><option value="">All statuses</option><option>Delivered</option><option>Shipped</option><option>Pending</option><option>Cancelled</option></select>
        </div>
        <div class="col-6 col-md-3">
          <label class="visually-hidden" for="ordSize">Rows per page</label>
          <select id="ordSize" class="form-select"><option value="5">5 per page</option><option value="8">8 per page</option><option value="12">12 per page</option></select>
        </div>
      </div>
      <div class="table-responsive">
        <table class="table table-hover align-middle mb-0 ord-table">
          <thead><tr><th scope="col" class="d-none d-md-table-cell">#</th><th scope="col">Customer</th><th scope="col" class="d-none d-md-table-cell">Location</th><th scope="col" class="d-none d-md-table-cell">Order date</th><th scope="col">Status</th><th scope="col" class="text-end">Amount</th><th scope="col" class="text-end"><span class="visually-hidden">Action</span></th></tr></thead>
          <tbody>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">1</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=11" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Michael Holz</span></div></td>
            <td class="d-none d-md-table-cell">London</td>
            <td class="d-none d-md-table-cell text-body-secondary">Jun 15, 2017</td>
            <td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
            <td class="text-end fw-semibold">$254</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1001" aria-label="View order 1001"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">2</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=5" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Paula Wilson</span></div></td>
            <td class="d-none d-md-table-cell">Madrid</td>
            <td class="d-none d-md-table-cell text-body-secondary">Jun 21, 2017</td>
            <td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
            <td class="text-end fw-semibold">$1,260</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1002" aria-label="View order 1002"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">3</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=33" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Antonio Moreno</span></div></td>
            <td class="d-none d-md-table-cell">Berlin</td>
            <td class="d-none d-md-table-cell text-body-secondary">Jul 04, 2017</td>
            <td data-status="Cancelled"><span class="badge rounded-pill ord-cancelled">Cancelled</span></td>
            <td class="text-end fw-semibold">$350</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1003" aria-label="View order 1003"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">4</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=47" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Mary Saveley</span></div></td>
            <td class="d-none d-md-table-cell">New York</td>
            <td class="d-none d-md-table-cell text-body-secondary">Jul 16, 2017</td>
            <td data-status="Pending"><span class="badge rounded-pill ord-pending">Pending</span></td>
            <td class="text-end fw-semibold">$1,572</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1004" aria-label="View order 1004"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">5</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=15" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Martin Sommer</span></div></td>
            <td class="d-none d-md-table-cell">Paris</td>
            <td class="d-none d-md-table-cell text-body-secondary">Aug 04, 2017</td>
            <td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
            <td class="text-end fw-semibold">$580</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1005" aria-label="View order 1005"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">6</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=45" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Sophie Laurent</span></div></td>
            <td class="d-none d-md-table-cell">Paris</td>
            <td class="d-none d-md-table-cell text-body-secondary">Aug 11, 2017</td>
            <td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
            <td class="text-end fw-semibold">$420</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1006" aria-label="View order 1006"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">7</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=52" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Liam O'Connor</span></div></td>
            <td class="d-none d-md-table-cell">Dublin</td>
            <td class="d-none d-md-table-cell text-body-secondary">Aug 19, 2017</td>
            <td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
            <td class="text-end fw-semibold">$980</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1007" aria-label="View order 1007"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">8</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=59" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Yuki Tanaka</span></div></td>
            <td class="d-none d-md-table-cell">Tokyo</td>
            <td class="d-none d-md-table-cell text-body-secondary">Aug 27, 2017</td>
            <td data-status="Pending"><span class="badge rounded-pill ord-pending">Pending</span></td>
            <td class="text-end fw-semibold">$310</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1008" aria-label="View order 1008"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">9</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=32" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Ana Silva</span></div></td>
            <td class="d-none d-md-table-cell">Lisbon</td>
            <td class="d-none d-md-table-cell text-body-secondary">Sep 02, 2017</td>
            <td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
            <td class="text-end fw-semibold">$1,890</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1009" aria-label="View order 1009"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">10</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=60" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Noah Becker</span></div></td>
            <td class="d-none d-md-table-cell">Berlin</td>
            <td class="d-none d-md-table-cell text-body-secondary">Sep 09, 2017</td>
            <td data-status="Cancelled"><span class="badge rounded-pill ord-cancelled">Cancelled</span></td>
            <td class="text-end fw-semibold">$75</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1010" aria-label="View order 1010"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">11</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=26" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Elena Rossi</span></div></td>
            <td class="d-none d-md-table-cell">Madrid</td>
            <td class="d-none d-md-table-cell text-body-secondary">Sep 14, 2017</td>
            <td data-status="Shipped"><span class="badge rounded-pill ord-shipped">Shipped</span></td>
            <td class="text-end fw-semibold">$640</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1011" aria-label="View order 1011"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          <tr>
            <td class="d-none d-md-table-cell text-body-secondary">12</td>
            <td><div class="d-flex align-items-center gap-2"><img src="https://i.pravatar.cc/64?img=68" width="32" height="32" class="rounded-circle" alt=""><span class="fw-semibold">Chris Evans</span></div></td>
            <td class="d-none d-md-table-cell">London</td>
            <td class="d-none d-md-table-cell text-body-secondary">Sep 22, 2017</td>
            <td data-status="Delivered"><span class="badge rounded-pill ord-delivered">Delivered</span></td>
            <td class="text-end fw-semibold">$2,150</td>
            <td class="text-end"><button type="button" class="btn btn-sm btn-outline-secondary rounded-circle p-0 ord-act" style="width:36px;min-height:36px" data-bs-toggle="tooltip" data-bs-title="View order #1012" aria-label="View order 1012"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></td>
          </tr>
          </tbody>
        </table>
        <p class="text-center wdw-muted py-5 mb-0 d-none" id="ordEmpty">No orders match your filters.</p>
      </div>
      <div class="p-4 d-flex flex-wrap align-items-center justify-content-between gap-3 border-top">
        <small class="wdw-muted" id="ordInfo" aria-live="polite"></small>
        <nav aria-label="Order pages"><ul class="pagination pagination-sm mb-0" id="ordPages"></ul></nav>
      </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.