Skip to content

Sortable Table

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

View template

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="/mero.js"></script>
Download library and examples ↓