Snippets Data

Bootstrap 5 Data Table with Filter Row and Search

A domain management table with status badges, quick filter pills and live search. Rows filter instantly and a counter keeps track of what is visible.

Bootstrap 5 No jQuery Sep 2020 2.5K views

<section class="wdw-stage">
  <div class="container w-100" style="max-width:960px">
    <div class="wdw-card border-0 overflow-hidden" id="domains">
      <div class="p-4 pb-3">
        <span class="wdw-eyebrow">Hosting</span>
        <h2 class="wdw-heading h4 mb-0">Manage domains</h2>
      </div>
      <div class="px-4 pb-3 d-flex flex-column flex-lg-row gap-3 justify-content-between align-items-lg-center">
        <div class="flex-grow-1" style="max-width:22rem">
          <label class="visually-hidden" for="domain-search">Search domains</label>
          <input class="form-control" id="domain-search" type="search" placeholder="Search domains" autocomplete="off" aria-controls="domain-table">
        </div>
        <fieldset class="d-flex flex-wrap gap-2 border-0 p-0 m-0">
          <legend class="visually-hidden">Filter by status</legend>
          <input type="radio" class="btn-check" name="status" id="f-all" value="all" autocomplete="off"  checked><label class="btn btn-sm btn-outline-primary rounded-pill" for="f-all">All <span class="badge text-bg-light rounded-pill ms-1">6</span></label>
          <input type="radio" class="btn-check" name="status" id="f-active" value="active" autocomplete="off"><label class="btn btn-sm btn-outline-primary rounded-pill" for="f-active">Active <span class="badge text-bg-light rounded-pill ms-1">3</span></label>
          <input type="radio" class="btn-check" name="status" id="f-inactive" value="inactive" autocomplete="off"><label class="btn btn-sm btn-outline-primary rounded-pill" for="f-inactive">Inactive <span class="badge text-bg-light rounded-pill ms-1">2</span></label>
          <input type="radio" class="btn-check" name="status" id="f-expired" value="expired" autocomplete="off"><label class="btn btn-sm btn-outline-primary rounded-pill" for="f-expired">Expired <span class="badge text-bg-light rounded-pill ms-1">1</span></label>
        </fieldset>
      </div>
      <div class="table-responsive">
        <table class="table table-hover align-middle mb-0" id="domain-table">
          <thead>
            <tr class="small text-body-secondary text-uppercase"><th class="ps-4">Domain</th><th class="d-none d-sm-table-cell">Status</th><th class="d-none d-md-table-cell">Renewal</th><th class="d-none d-lg-table-cell">Server</th><th class="pe-4"><span class="visually-hidden">Action</span></th></tr>
          </thead>
          <tbody>
            <tr data-status="active">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">L</span><div><a class="fw-semibold" href="#">loremvallis.org</a><div class="small text-body-secondary d-md-none">Apr 10, 2013 <span class="badge rounded-pill bg-success-subtle text-success-emphasis d-sm-none ms-1">Active</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-success-subtle text-success-emphasis"><span class="dot bg-success"></span>Active</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Renews Apr 10</div><div class="small text-danger">in 12 days</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">Buenos Aires</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage loremvallis.org">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr data-status="inactive">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">Q</span><div><a class="fw-semibold" href="#">quisquamut.net</a><div class="small text-body-secondary d-md-none">May 8, 2014 <span class="badge rounded-pill bg-warning-subtle text-warning-emphasis d-sm-none ms-1">Inactive</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-warning-subtle text-warning-emphasis"><span class="dot bg-warning"></span>Inactive</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Paused</div><div class="small text-body-secondary">renew to reactivate</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">Australia</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage quisquamut.net">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr data-status="active">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">C</span><div><a class="fw-semibold" href="#">convallissed.com</a><div class="small text-body-secondary d-md-none">Nov 5, 2015 <span class="badge rounded-pill bg-success-subtle text-success-emphasis d-sm-none ms-1">Active</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-success-subtle text-success-emphasis"><span class="dot bg-success"></span>Active</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Renews Nov 5</div><div class="small text-body-secondary">in 6 months</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">United Kingdom</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage convallissed.com">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr data-status="expired">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">P</span><div><a class="fw-semibold" href="#">phasellusri.org</a><div class="small text-body-secondary d-md-none">Sep 6, 2016 <span class="badge rounded-pill bg-danger-subtle text-danger-emphasis d-sm-none ms-1">Expired</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-danger-subtle text-danger-emphasis"><span class="dot bg-danger"></span>Expired</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Expired Sep 6</div><div class="small text-danger">pay to restore</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">Romania</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage phasellusri.org">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr data-status="inactive">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">F</span><div><a class="fw-semibold" href="#">facilisleo.com</a><div class="small text-body-secondary d-md-none">Dec 8, 2017 <span class="badge rounded-pill bg-warning-subtle text-warning-emphasis d-sm-none ms-1">Inactive</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-warning-subtle text-warning-emphasis"><span class="dot bg-warning"></span>Inactive</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Paused</div><div class="small text-body-secondary">renew to reactivate</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">Germany</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage facilisleo.com">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr data-status="active">
              <td class="ps-4"><div class="d-flex align-items-center gap-3"><span class="tile" aria-hidden="true">N</span><div><a class="fw-semibold" href="#">nuncmaurisdev.io</a><div class="small text-body-secondary d-md-none">Feb 21, 2019 <span class="badge rounded-pill bg-success-subtle text-success-emphasis d-sm-none ms-1">Active</span></div></div></div></td>
              <td class="d-none d-sm-table-cell"><span class="badge rounded-pill bg-success-subtle text-success-emphasis"><span class="dot bg-success"></span>Active</span></td>
              <td class="d-none d-md-table-cell text-nowrap"><div>Renews Feb 21</div><div class="small text-body-secondary">in 4 months</div></td>
              <td class="d-none d-lg-table-cell text-body-secondary text-nowrap">Netherlands</td>
              <td class="text-end pe-4">
                <div class="dropdown">
                  <button class="btn btn-sm btn-outline-primary rounded-pill px-3 dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Manage nuncmaurisdev.io">Manage</button>
                  <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#">DNS settings</a></li>
                    <li><a class="dropdown-item" href="#">Renew</a></li>
                    <li><a class="dropdown-item" href="#">Transfer</a></li>
                    <li><hr class="dropdown-divider"></li>
                    <li><a class="dropdown-item text-danger" href="#">Delete</a></li>
                  </ul>
                </div>
              </td>
            </tr>
            <tr id="domain-empty" hidden><td colspan="5" class="text-center text-body-secondary py-5">No domains match your search or filter.</td></tr>
          </tbody>
        </table>
      </div>
      <div class="px-4 py-3 border-top small text-body-secondary">
        <span id="domain-count" role="status" aria-live="polite">Showing 6 of 6 domains</span>
      </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.