Category Β· Widgets Difficulty Level Β· Intermediate Published on Β· January 22, 2025

Modern Data Table with Sorting and Filtering

Elegant data table with sorting, filtering, and pagination features, perfect for displaying structured data in web applications.

#table #data #sorting #filtering #pagination #ui

Responsive Design

Yes

Dark Mode Support

No

lines

483

Browser Compatibility

No

Live Preview

Interact with the component without leaving the page.

400px

HTML

88

lines

CSS

229

lines

JavaScript

166

lines


                <div class="data-table-container">
  <div class="table-header">
    <h2>Employee Directory</h2>
    <div class="table-controls">
      <div class="search-box">
        <input type="text" id="searchInput" placeholder="Search employees..." />
        <span class="search-icon">πŸ”</span>
      </div>
      <div class="filter-dropdown">
        <select id="departmentFilter">
          <option value="">All Departments</option>
          <option value="Engineering">Engineering</option>
          <option value="Marketing">Marketing</option>
          <option value="Sales">Sales</option>
          <option value="HR">HR</option>
        </select>
      </div>
    </div>
  </div>
  
  <div class="table-wrapper">
    <table class="data-table" id="employeeTable">
      <thead>
        <tr>
          <th data-sort="name">Name <span class="sort-icon">↕</span></th>
          <th data-sort="department">Department <span class="sort-icon">↕</span></th>
          <th data-sort="position">Position <span class="sort-icon">↕</span></th>
          <th data-sort="salary">Salary <span class="sort-icon">↕</span></th>
          <th data-sort="joinDate">Join Date <span class="sort-icon">↕</span></th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>John Smith</td>
          <td>Engineering</td>
          <td>Senior Developer</td>
          <td>\$95,000</td>
          <td>2020-05-15</td>
        </tr>
        <tr>
          <td>Sarah Johnson</td>
          <td>Marketing</td>
          <td>Marketing Manager</td>
          <td>\$78,000</td>
          <td>2019-03-22</td>
        </tr>
        <tr>
          <td>Mike Davis</td>
          <td>Sales</td>
          <td>Sales Representative</td>
          <td>\$65,000</td>
          <td>2021-08-10</td>
        </tr>
        <tr>
          <td>Emily Wilson</td>
          <td>HR</td>
          <td>HR Specialist</td>
          <td>\$72,000</td>
          <td>2020-11-05</td>
        </tr>
        <tr>
          <td>David Brown</td>
          <td>Engineering</td>
          <td>Frontend Developer</td>
          <td>\$88,000</td>
          <td>2021-01-18</td>
        </tr>
        <tr>
          <td>Lisa Anderson</td>
          <td>Marketing</td>
          <td>Content Creator</td>
          <td>\$58,000</td>
          <td>2022-04-12</td>
        </tr>
      </tbody>
    </table>
  </div>
  
  <div class="table-footer">
    <div class="pagination">
      <button class="pagination-btn" id="prevPage">Previous</button>
      <span class="pagination-info">
        Page <span id="currentPage">1</span> of <span id="totalPages">1</span>
      </span>
      <button class="pagination-btn" id="nextPage">Next</button>
    </div>
  </div>
</div>

              
88lines
2702characters
HTMLLanguage

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library β†’