Pagination
<nav class="pagination" aria-label="Pagination"> <ul class="pagination-list"> <li><a class="btn btn-ghost btn-sm" href="#overview">Previous</a></li> <li><a class="btn btn-ghost btn-icon-sm" href="#overview">1</a></li> <li><a class="btn btn-outline btn-icon-sm" href="#overview" aria-current="page">2</a></li> <li><a class="btn btn-ghost btn-icon-sm" href="#overview">3</a></li> <li> <span class="pagination-ellipsis"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <circle cx="5" cy="12" r="1"></circle><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle> </svg> <span class="sr-only">More pages</span> </span> </li> <li><a class="btn btn-ghost btn-icon-sm" href="#overview">9</a></li> <li><a class="btn btn-ghost btn-sm" href="#overview">Next</a></li> </ul></nav><nav class="pagination" aria-label="Pagination"> <ul class="pagination-list"> <li><a class="btn btn-ghost btn-sm" href="?page=1">Previous</a></li> <li><a class="btn btn-outline btn-icon-sm" href="?page=2" aria-current="page">2</a></li> </ul></nav>| Class | Part |
|---|---|
.pagination | The <nav> |
.pagination-list | The <ul> of pages |
.pagination-ellipsis | A gap in the sequence |
The pages themselves are buttons — ghost for the rest, outline for the current one — so there is no third set of classes to learn.
Set dir="rtl" on the page or on any subtree — the row follows the reading direction, so
“Previous” sits on the right. See the button page for a live example.
Accessibility
Section titled “Accessibility”aria-label="Pagination"on the<nav>, so it is distinguishable from other navigations.aria-current="page"on the current page. The outline variant shows it;aria-currentannounces it.- Previous and next need to say where they go when they are icon-only:
aria-label="Previous page", not just an arrow. - Disable the ends rather than hiding them. A control that disappears at the first page shifts the row under the pointer; one that is disabled stays put.