Snippets Responsive

Bootstrap 5 Responsive Table with Search and Mobile Cards

A responsive data table with a search box, avatar names, job-title pills and a hover state. Below tablet width each row turns into a labelled card so nothing scrolls sideways.

Bootstrap 5 No jQuery Jun 2019 3.4K views

<section class="wdw-stage">
  <div class="container" style="max-width: 900px">
    <div class="wdw-card overflow-hidden">
      <div class="d-flex flex-wrap align-items-center justify-content-between gap-3 p-4">
        <div>
          <h1 class="h4 wdw-heading mb-0">Team members</h1>
          <p class="small wdw-muted mb-0">6 people across 5 cities</p>
        </div>
        <input type="search" class="form-control rounded-pill" id="tableSearch" placeholder="Search people" aria-label="Search people" style="max-width: 16rem">
      </div>
      <div class="table-responsive">
        <table class="table table-hover align-middle mb-0 rt-table">
          <thead>
            <tr><th scope="col">Full name</th><th scope="col">Age</th><th scope="col">Job title</th><th scope="col">Location</th></tr>
          </thead>
          <tbody>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=12" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Vincent Williamson</span></div></td>
            <td data-label="Age">31</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">iOS Developer</span></td>
            <td data-label="Location" class="text-body-secondary">Washington</td>
          </tr>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=32" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Joseph Smith</span></div></td>
            <td data-label="Age">27</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">Project Manager</span></td>
            <td data-label="Location" class="text-body-secondary">Somerville, MA</td>
          </tr>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=45" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Justin Black</span></div></td>
            <td data-label="Age">26</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">Front-End Developer</span></td>
            <td data-label="Location" class="text-body-secondary">Los Angeles</td>
          </tr>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=47" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Sean Guzman</span></div></td>
            <td data-label="Age">25</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">Web Designer</span></td>
            <td data-label="Location" class="text-body-secondary">San Francisco</td>
          </tr>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=51" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Keith Carter</span></div></td>
            <td data-label="Age">20</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">Graphic Designer</span></td>
            <td data-label="Location" class="text-body-secondary">New York, NY</td>
          </tr>
          <tr>
            <td data-label="Full name"><div class="d-flex align-items-center gap-3"><img src="https://i.pravatar.cc/80?img=15" alt="" width="36" height="36" class="rounded-circle"><span class="fw-semibold">Austin Medina</span></div></td>
            <td data-label="Age">32</td>
            <td data-label="Job title"><span class="badge rounded-pill bg-body-secondary text-body-emphasis fw-medium">Photographer</span></td>
            <td data-label="Location" class="text-body-secondary">New York</td>
          </tr>
          </tbody>
        </table>
      </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.