Skip to content

Sortable Table

Sort server-rendered rows from the column headers and open a row from anywhere in it.

View template
Studio products · 8 of 8
Product Category Status Actions
Arc Task Lamp Lighting Active
Ash Lounge Chair Furniture Archived
Brass Candle Holder Objects Active
Halo Pendant Lighting Draft
Linen Cushion Textiles Draft
Oak Side Table Furniture Active
Stone Vase Objects Active
Woven Throw Textiles Archived

Each header links to ?sort=column, and a leading minus sorts descending. The server marks the sorted column with aria-sort. Each row has one real link whose pseudo-element covers the row, so the row's menu keeps working. Remove mero-table-compact for regular density. With HTMX, hx-boost swaps only the table and pushes the URL. data-mero-restore-focus returns focus to the opened row after Back.

Use in your app

Copy these tags into your page head once. Serve the files at the paths shown, then add the example’s template to your page.

Page assets
<link rel="stylesheet" href="/mero.css">
<script defer src="/vendor/htmx.min.js"></script>
<script defer src="/mero.js"></script>

Point the HTMX attributes at your own HTML endpoints. Use the live preview’s HTTP exchange to inspect the request and response.

Download library and examples ↓