A pagination component splits a long list into numbered pages and lets people jump between them. Build it as a <nav> with a clear label, a list of real <a href> links to URLs such as ?page=3, and aria-current="page" on the current page. Show first, last and nearby pages, and hide it when there is only one page.
This guide covers when pagination beats "load more" and infinite scroll, the accessible markup, the logic that decides which page numbers to show, crawlable URLs, a tested React pagination component with CSS, and a "load more" link that search engines can still follow. For tabs, steppers and other ways to move around a site, browse the navigation components collection. If you are building tabs rather than pages, our tab bar design guide covers that pattern.
Pagination vs load more vs infinite scroll
Google's Search Central guide to pagination and incremental page loading (last updated December 2025) describes the trade-off plainly. Pagination "gives users insight into result size and current position", but the controls are more complex and every page is a new load. Load more and infinite scroll keep everything on one page, and neither can handle very large numbers of results. Infinite scroll can also cause "scrolling fatigue" because people cannot tell how much is left.
| Pattern | Good fit | Watch out for |
|---|---|---|
| Pagination | Search results, archives, catalogs, tables, anything people come back to or compare | Too many page numbers on small screens; pages that never change URL |
| Load more | Medium lists where people browse in order and want to stay on one page | Very large lists; a button that crawlers cannot follow |
| Infinite scroll | Flat feeds of equally relevant items, browsed for fun | Finding a specific item, comparing items, reaching the footer, keyboard access |
| No pagination | Short lists, about three or four screens or less | Slow pages once the list grows |
The infinite scroll row comes from Nielsen Norman Group. Its article on when to use infinite scrolling recommends it for content with a flat structure that streams constantly, and lists the costs: people struggle to find an item again, a gap can look like the end of the page, and the footer becomes unreachable. An older NN/g piece on why infinite scrolling is not for every website says it "is not recommended for goal-oriented finding tasks", such as locating specific content or comparing options. NN/g also says no solution is "overall superior", so treat the table as a starting point.
Two government design systems add the edges. The GOV.UK pagination component asks teams to avoid infinite scroll because "this causes problems for keyboard users", and not to show pagination at all when there is only one page. The CMS Design System suggests showing every item at once when the whole collection is shorter than three or four screen lengths, and rules out pagination for step-by-step flows such as checkout.

Accessible pagination markup
The MDN pagination cookbook, GOV.UK and CMS agree on the essentials:
- Wrap the component in a
<nav>element with anaria-labelsuch as "Pagination". A page usually has more than one navigation landmark, and the APG landmark guidance asks for a unique label on each. - Put the page numbers in a
<ul>, so screen readers announce how many items there are. - Use links, not buttons. CMS says it directly: "Do not use buttons for URL-based pagination." The URL changes and the browser history updates, so a link is the right element.
- Mark the current page with
aria-current="page". - Say "page" before each number with visually hidden text, so a screen reader reads "Page 5" instead of a bare "5".
- Drop the Previous link on the first page and the Next link on the last page.
- Use an ellipsis for skipped pages. It is plain text, not a link.
GOV.UK adds one more rule that is easy to miss: put the page number in the page <title>, for example "Search results (page 5 of 12)", so screen reader users know a new page has loaded.
Here is the markup for page 5 of 12:
<nav class="pagination" aria-label="Pagination">
<a class="pagination-step" href="/blog?page=4">Previous<span class="visually-hidden"> page</span></a>
<ul class="pagination-list">
<li><a href="/blog"><span class="visually-hidden">Page </span>1</a></li>
<li class="pagination-gap">…</li>
<li><a href="/blog?page=4"><span class="visually-hidden">Page </span>4</a></li>
<li><a href="/blog?page=5" aria-current="page"><span class="visually-hidden">Page </span>5</a></li>
<li><a href="/blog?page=6"><span class="visually-hidden">Page </span>6</a></li>
<li class="pagination-gap">…</li>
<li><a href="/blog?page=12"><span class="visually-hidden">Page </span>12</a></li>
</ul>
<a class="pagination-step" href="/blog?page=6">Next<span class="visually-hidden"> page</span></a>
</nav>
Previous and Next sit outside the list, as in GOV.UK, so the list only counts page numbers and the two links can wrap onto their own line on a narrow screen.
Which page numbers to show
Showing all 40 page numbers does not fit, and showing only Previous and Next hides the size of the set. GOV.UK's rule works on any screen: always show the first page, the last page, the current page and one page on each side of it, and replace every skipped run with an ellipsis. Its examples for 100 pages:
[1] 2 … 1001 2 3 [4] 5 … 100(page 2 is shown, because an ellipsis would hide a single page)1 … 4 [5] 6 … 1001 … 97 [98] 99 100
This function returns exactly those sequences. 'gap' marks an ellipsis.
export function getPageItems(current, total, siblings = 1) {
const start = Math.max(2, current - siblings);
const end = Math.min(total - 1, current + siblings);
const items = [1];
if (start === 3) items.push(2);
else if (start > 3) items.push('gap');
for (let page = start; page <= end; page++) items.push(page);
if (end === total - 2) items.push(total - 1);
else if (end < total - 2) items.push('gap');
if (total > 1) items.push(total);
return items;
}
export function parsePage(value, total) {
if (value === null) return 1;
const page = Number(value);
return Number.isInteger(page) && page >= 1 && page <= total ? page : null;
}
parsePage reads the page query parameter on the server. A missing parameter means page 1. Anything else that is not a whole number between 1 and the last page returns null, and GOV.UK's advice for that case is to redirect people to the first page.
Crawlable URLs for paginated pages
Google's guide is specific about what search engines need:
- Links, not clicks. Google crawls URLs in the
hrefof<a>elements, and its crawlers "don't 'click' buttons". Link each page to the next one with<a href>, and consider linking every page back to the first. - One URL per page. Use something like
?page=n. Do not use#page=2: Google ignores fragments and may never fetch the next page. - Own canonical. Give each page its own canonical URL. Do not point every page's canonical at page 1.
- Same titles are fine. Pages in a sequence can share a title and description, so adding "(page 5 of 12)" for screen reader users does no harm.
- rel="next" is retired. Google no longer uses
rel="next"andrel="prev", though other search engines may. - Keep filter and sort variants out of the index, for example
?order=price, so the same results do not appear under many URLs.
React pagination component
The component renders the markup above from current, total and an hrefFor function, so it works with any router and with server rendering. It renders nothing when there is only one page.
import { getPageItems } from './pagination.js';
export function Pagination({ current, total, hrefFor, label = 'Pagination' }) {
if (total <= 1) return null;
return (
<nav className="pagination" aria-label={label}>
{current > 1 && (
<a className="pagination-step" href={hrefFor(current - 1)}>
Previous<span className="visually-hidden"> page</span>
</a>
)}
<ul className="pagination-list">
{getPageItems(current, total).map((item, i) =>
item === 'gap' ? (
<li key={`gap-${i}`} className="pagination-gap">…</li>
) : (
<li key={item}>
<a href={hrefFor(item)} aria-current={item === current ? 'page' : undefined}>
<span className="visually-hidden">Page </span>
{item}
</a>
</li>
)
)}
</ul>
{current < total && (
<a className="pagination-step" href={hrefFor(current + 1)}>
Next<span className="visually-hidden"> page</span>
</a>
)}
</nav>
);
}
// <Pagination current={5} total={12} hrefFor={(page) => (page === 1 ? '/blog' : `/blog?page=${page}`)} />
Page 1 links to /blog rather than /blog?page=1, so the first page has a single URL. If your router has its own link component, use it in place of <a>, as long as it renders a real href. One honest exception: if paging only swaps rows inside a widget and never changes the URL, such as a small table in a dashboard card, buttons are the accurate element. CMS's links rule is about URL-based pagination.
.pagination {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.pagination-list {
display: flex;
gap: 0.25rem;
margin: 0;
padding: 0;
list-style: none;
}
.pagination a,
.pagination-gap {
display: inline-flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
min-width: 2.5rem;
min-height: 2.5rem;
padding: 0 0.5rem;
}
.pagination a {
border-radius: 0.5rem;
color: #1d4ed8;
text-underline-offset: 0.2em;
}
.pagination a:hover {
background: #eff6ff;
}
.pagination a[aria-current="page"] {
background: #1d4ed8;
color: #fff;
text-decoration: none;
}
.pagination a:focus-visible {
outline: 2px solid #1d4ed8;
outline-offset: 2px;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
Every link is at least 40 by 40 CSS px, well above the 24 by 24 px minimum in WCAG 2.5.8. The current page loses its underline and gains a solid fill, so it does not rely on color alone. The blue on white, and white on the blue fill, both measure about 6.7:1. The numbered list never wraps, as CMS recommends, while Previous and Next can move to their own line on a phone. With one neighbour on each side, the list holds at most seven items: at 40 px each plus the gaps, that is 304 px, narrow enough for a 360 px phone screen.

A load more link that crawlers can follow
If you prefer "load more", keep it crawlable by making it a link to the next page that JavaScript upgrades. Without JavaScript, or for a crawler, it is an ordinary link to /blog?page=2, which the server renders as a full page.
<ul id="posts">
<li><a href="/blog/first-post">First post</a></li>
<li><a href="/blog/second-post">Second post</a></li>
</ul>
<a class="load-more" href="/blog?page=2">Load more posts</a>
const list = document.getElementById('posts');
const more = document.querySelector('.load-more');
more.addEventListener('click', async (event) => {
event.preventDefault();
const response = await fetch(more.href);
if (!response.ok) {
window.location.assign(more.href);
return;
}
const page = new DOMParser().parseFromString(await response.text(), 'text/html');
const items = [...page.querySelectorAll('#posts > li')];
list.append(...items);
const next = page.querySelector('.load-more');
if (next) more.setAttribute('href', next.getAttribute('href'));
else more.remove();
if (items.length) {
items[0].tabIndex = -1;
items[0].focus();
}
});
After loading, focus moves to the first new item, so keyboard and screen reader users continue from the new content instead of staying on the button. On the last page the link disappears. If the request fails, the script falls back to following the link.
Pagination design checklist
- [ ] You picked the right pattern for the task: pagination, load more, infinite scroll or one page (see the table).
- [ ] The component is a labelled
<nav>with a<ul>of<a href>links. - [ ] The current page has
aria-current="page"and a visible state that is more than color. - [ ] Page numbers read as "Page 5", and Previous and Next read as "Previous page" and "Next page".
- [ ] First, last, current and neighbouring pages are visible, and skipped pages show an ellipsis.
- [ ] No Previous link on page 1, no Next link on the last page, no component at all for a single page.
- [ ] Each page has its own URL such as
?page=n, its own canonical, and the page number in the<title>. - [ ] An out-of-range page URL redirects to page 1.
- [ ] Targets are at least 24 by 24 CSS px, and focus is clearly visible.
FAQ
Is pagination outdated?
No. Pagination is still the better fit when people search, compare or return to a specific item, as in search results, archives and catalogs. Google's Search Central guide notes that it shows the size of the results and your current position, and Nielsen Norman Group does not recommend infinite scroll for goal-oriented finding tasks. Load more and infinite scroll suit medium lists and flat feeds. NN/g also says no option is overall superior, so choose by task.
How is pagination implemented?
On the page, render a <nav> with an aria-label, a <ul> of real <a href> links to URLs such as ?page=3, and aria-current="page" on the current page. Show the first, last and current pages plus one neighbour on each side, with an ellipsis for skipped runs. On the server, read the page query parameter, render that page as a full page, and redirect out-of-range values to page 1. Hide the component when there is only one page.
How should pagination work on mobile?
Keep the numbered list short and the targets large. With one neighbour on each side of the current page, the list holds at most seven items, and at 40 by 40 CSS px each it fits a 360px phone screen. Keep the numbers on one line and let Previous and Next wrap onto their own line instead. Every target should be at least 24 by 24 CSS px, the WCAG 2.5.8 minimum, and the current page should stand out with more than color.
Start from a HorizonX component
HorizonX does not have a dedicated pagination component today, so the code above is the main deliverable. The closest visual starting point is Beacon Tabs: a row of two to six numbered tiles that animates the selection, with a visible focus ring and a reduced-motion fallback, exporting as HTML, Svelte or React. It is built as a radio group (role="radiogroup" with native radios), which is not pagination markup. If you like its look for a short sequence of pages, keep the styling and swap the radios for the <nav>, links and aria-current shown above.
For tabs, steppers and other navigation patterns, see the navigation components collection.