Numbered
First, current and last pages, with arrow-only Previous and Next: 1 … 7 … 20. On desktop, one page either side of the current one.
Lets people move through a long list that is split into pages, such as search results, news or publications.
Added · New
Pagination
Paste this markup after the list, left aligned with it
<nav class="nds-pagination" aria-label="Pagination"> <ul class="nds-pagination__list"> <li class="nds-pagination__item"> <a class="nds-pagination__link nds-pagination__link--prev" href="?page=6" rel="prev"> <svg class="nds-pagination__icon" aria-hidden="true" focusable="false"> <use href="#nds-icon-arrow-left"> </use> </svg> <span class="nds-pagination__label"> Previous </span> </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=1" aria-label="Page 1"> 1 </a> </li> <li class="nds-pagination__item nds-pagination__item--ellipsis" aria-hidden="true"> … </li> <li class="nds-pagination__item nds-pagination__item--desktop"> <a class="nds-pagination__link" href="?page=6" aria-label="Page 6"> 6 </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=7" aria-label="Page 7" aria-current="page"> 7 </a> </li> <li class="nds-pagination__item nds-pagination__item--desktop"> <a class="nds-pagination__link" href="?page=8" aria-label="Page 8"> 8 </a> </li> <li class="nds-pagination__item nds-pagination__item--ellipsis" aria-hidden="true"> … </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=20" aria-label="Page 20"> 20 </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link nds-pagination__link--next" href="?page=8" rel="next"> <span class="nds-pagination__label"> Next </span> <svg class="nds-pagination__icon" aria-hidden="true" focusable="false"> <use href="#nds-icon-arrow-right"> </use> </svg> </a> </li> </ul></nav> Usage
<!-- wp:nds/pagination {} --><nav class="nds-pagination" aria-label="Pagination"> <ul class="nds-pagination__list"> <li class="nds-pagination__item"> <a class="nds-pagination__link nds-pagination__link--prev" href="?page=6" rel="prev"> <svg class="nds-pagination__icon" aria-hidden="true" focusable="false"> <use href="#nds-icon-arrow-left"> </use> </svg> <span class="nds-pagination__label"> Previous </span> </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=1" aria-label="Page 1"> 1 </a> </li> <li class="nds-pagination__item nds-pagination__item--ellipsis" aria-hidden="true"> … </li> <li class="nds-pagination__item nds-pagination__item--desktop"> <a class="nds-pagination__link" href="?page=6" aria-label="Page 6"> 6 </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=7" aria-label="Page 7" aria-current="page"> 7 </a> </li> <li class="nds-pagination__item nds-pagination__item--desktop"> <a class="nds-pagination__link" href="?page=8" aria-label="Page 8"> 8 </a> </li> <li class="nds-pagination__item nds-pagination__item--ellipsis" aria-hidden="true"> … </li> <li class="nds-pagination__item"> <a class="nds-pagination__link" href="?page=20" aria-label="Page 20"> 20 </a> </li> <li class="nds-pagination__item"> <a class="nds-pagination__link nds-pagination__link--next" href="?page=8" rel="next"> <span class="nds-pagination__label"> Next </span> <svg class="nds-pagination__icon" aria-hidden="true" focusable="false"> <use href="#nds-icon-arrow-right"> </use> </svg> </a> </li> </ul></nav><!-- /wp:nds/pagination --> Usage
import { Pagination } from "@nigerian-design-standards/react";<Pagination currentPage={7} totalPages={20} hrefTemplate="?page={n}"/> Usage
use NDS\Components\Pagination;echo Pagination::render([ 'currentPage' => 7, 'totalPages' => 20, 'hrefTemplate' => '?page={n}',]); Put pagination after a long list, left aligned with it. It shows where people are in the list and lets them move to other pages.
Three types, each with a desktop and a mobile version. The mobile versions are shown here: first, current and last pages only.
First, current and last pages, with arrow-only Previous and Next: 1 … 7 … 20. On desktop, one page either side of the current one.
No numbers. “Page 7 of 20” between the links. For feeds and news, when the order matters more than the position.
Under a data table. The count and rows per page sit on one line, with the pager below. On desktop they share one line with the pager.
The properties of pagination. The same in HTML and React.
| Property | Type | Possible values | Description |
|---|---|---|---|
| currentPage | number |
| Required. The page shown. Filled and marked aria-current="page". |
| totalPages | number |
| Required for Numbered. Hide pagination when there is only one page. |
| type | string |
| Optional. Defaults to "numbered". |
| hrefTemplate | string |
| Required. Keeps the page in the URL, so links and the back button work. |
| rowsPerPage | number |
| Table only. Defaults to 10. Changing it goes back to page 1 and keeps the sort. |
In code, pagination is a <nav aria-label="Pagination"> after the
list, with a <ul>. Each page is <a href="?page=6" aria-label="Page 6">. The current page
is <a aria-current="page">. Previous and Next use rel="prev" and rel="next"; on small screens the
word is visually hidden but still read. The ellipsis is <li aria-hidden="true">. Hide Previous on the first page and Next
on the last; never show them disabled.
| Part | Token | Contrast on the page |
|---|---|---|
| Page number | Body/medium · text/primary · 40×40 (spacing/500) | 17.6:1 |
| Current page | Body/medium-emphasized · brand/900 on action/primary/subtle | 13.1:1 |
| Previous / Next | Body/medium · text/primary · size/icon/md arrows · spacing/100 gap | 17.6:1 |
| Ellipsis and status | Body/small · text/secondary | 6.6:1 |
| Hover | action/tertiary/hover tint, underlined | Decorative |
| Spacing | spacing/150 side padding · spacing/050 between items · radius/050 | — |
| Focus | Focus ring (border/focus), on :focus-visible | — |
Hide Previous on the first page and Next on the last. Show the first, current and last pages, with … for gaps.
Don’t show Previous or Next greyed out, and don’t put pagination only at the top of the list. Put it after the list, where people finish reading.
Where pagination goes and which pages it shows.
Directly under it, the same width. One pager per list.
If the gap is exactly 1 page, show the number: 1 2 3 4 … 20.
How to word the controls and the count.
Not “Back”, “Older” or « on its own. The arrow is extra.
aria-label “Page 6”, so screen readers say more than a number.
| Write | Don’t write | Why |
|---|---|---|
| Previous | « Prev | Plain words, not symbols on their own. |
| Page 7 of 20 | 7/20 | Read clearly by screen readers. |
| Showing 61–70 of 196 results | Results | Says where people are in the list. |
| Next is hidden on the last page | Next shown greyed out | A disabled link is a dead end. |
| Search results, page 7 of 20 | Search results | The page title says which page people are on. |
Pagination is a named navigation landmark. After a page change, focus moves to the result count or list heading, not the bottom of the new page.
| Key | What it does |
|---|---|
| Tab | Moves through Previous, the page numbers and Next, left to right. The ellipsis is skipped. |
| Shift + Tab | Moves back. |
| Enter | Goes to that page. Focus moves to the result count or list heading. |
Copy the code for HTML, WordPress or React from the Code tab in Live example. The options are listed under Specifications.
Use Pagination from 01 Library – Foundations. Pick Numbered, Previous and next or Table, and Desktop or Mobile. Change the page numbers with Pagination item. Don’t detach it.
Is this page useful?