Pagination
Navigate between result pages with server-rendered fragments.
Design references
HTML
<div class="rl-scope" data-rl-scope>
<div id="catalog-pagination" data-rl-pagination class="rl-stack">
<p class="rl-description" role="status">Design references</p>
<nav class="rl-pagination" aria-label="Results pages">
<button class="rl-button rl-button-sm rl-button-primary" id="demo-pagination-page-1" type="button"
hx-get="/demo/catalog/pagination?page=1" hx-target="closest [data-rl-pagination]" hx-swap="innerHTML"
aria-current="page">1</button>
<button class="rl-button rl-button-sm rl-button-outline" id="demo-pagination-page-2" type="button"
hx-get="/demo/catalog/pagination?page=2" hx-target="closest [data-rl-pagination]" hx-swap="innerHTML"
>2</button>
<button class="rl-button rl-button-sm rl-button-outline" id="demo-pagination-page-3" type="button"
hx-get="/demo/catalog/pagination?page=3" hx-target="closest [data-rl-pagination]" hx-swap="innerHTML"
>3</button>
</nav>
</div>
</div>HTTP exchange
Use the preview to see the request and the HTML your server returns.The server returns the next result and its updated paginator together.
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 ↓