Components
Pagination
Page through long lists. Write the links yourself, or give Moey the number of pages and it builds the buttons — with smart "…" gaps.
<!-- Moey builds it (buttons; listen for moey:page) -->
<nav class="pagination" data-moey-pages="24" data-moey-page="5"></nav>
<!-- …as real links -->
<nav class="pagination" data-moey-pages="24" data-moey-page="5" data-moey-href="?page={page}"></nav>
<!-- …or write it yourself (works without JavaScript) -->
<nav class="pagination" aria-label="Pagination">
<a class="page-prev" href="?page=4" aria-label="Previous page"></a>
<a class="page" href="?page=1">1</a>
<span class="page-gap">…</span>
<a class="page" href="?page=5" aria-current="page">5</a>
<a class="page-next" href="?page=6" aria-label="Next page"></a>
</nav>
In a table footer
…your table…
<div class="card-footer">
<span class="pagination-info">Showing 41–50 of 248</span> <!-- pushes the pages to the end -->
<nav class="pagination pagination-sm" data-moey-pages="25" data-moey-page="5"></nav>
</div>
| Class / attribute | What it does |
|---|---|
data-moey-pages · data-moey-page | Total and current page — Moey renders the buttons |
data-moey-href="?page={page}" | Real links instead of buttons |
data-moey-siblings | Pages shown each side of the current one (default 1; 0 on phones) |
data-moey-labels | "Previous" / "Next" text next to the arrows (arrows only on phones) |
.pagination-filled | Every button has its own soft background |
.pagination-segmented | In a tray, with a raised current page |
.pagination-sm · .pagination-lg | Sizes |
.pagination-info | The "Showing 1–10 of 248" text |
nav.addEventListener('moey:page', (e) => loadOrders(e.detail.page)); // e.preventDefault() keeps the current page
Moey.paginate(nav, { page: 1, pages: 30 }); // e.g. after filtering
The current page uses the theme's soft solid shade, like solid buttons. The number of page slots stays the same as you move, so the row doesn't jump around.
More colors
The current page follows theme-<color>, in every pagination style.
<nav class="pagination theme-pink" data-moey-pages="8" data-moey-page="3"></nav>
Real links
With data-moey-href every page is a normal link, so it works with server-rendered pages and opens in a new tab.
<nav class="pagination" data-moey-pages="12" data-moey-page="3" data-moey-href="?page={page}"></nav>
Sizes
<div class="grid grid-cols-1 gap-4">
<nav class="pagination pagination-sm" data-moey-pages="10" data-moey-page="4"></nav>
<nav class="pagination" data-moey-pages="10" data-moey-page="4"></nav>
<nav class="pagination pagination-lg" data-moey-pages="10" data-moey-page="4"></nav>
</div>
Colors
The current page follows the theme.
<div class="grid grid-cols-1 gap-4">
<nav class="pagination theme-purple" data-moey-pages="8" data-moey-page="2"></nav>
<nav class="pagination pagination-filled theme-green" data-moey-pages="8" data-moey-page="6"></nav>
</div>
Just previous and next
For feeds and search results where the total is unknown.
Page 3
<div class="flex justify-between items-center gap-4">
<button class="btn"><i class="mi mi-arrow-left"></i>Newer</button>
<span class="pagination-info">Page 3</span>
<button class="btn">Older<i class="mi mi-arrow-right"></i></button>
</div>