UI pagination
Page numbers, previous and next links, current location, and accessibility, with the publishing and web-navigation background.
· Last updated: 2026-11-07 · 8 min read
Overview
UI pagination breaks a long collection or multi-part document into manageable groups so people can move through it without losing their place. Page numbers, previous and next links, and a clear marker for the current page do the heavy lifting: open page two of search results and you should immediately see which slice is on screen and how to step backward or forward.
Splitting a list gives the reader a bounded set to scan. Picking a page size is the easy part, whereas keeping active search filters intact across clicks, restoring the exact spot when the user hits Back, and making every control legible to keyboard and screen-reader users take real design care.
Numbered buttons on screen never dictate how the server fetches rows. Behind the exact same navigation bar might sit an SQL OFFSET query, a keyset seek, or an in-memory array already loaded in the browser; the UI owns orientation and movement, while the retrieval layer decides how the slice is produced.
For server-side slicing strategies such as OFFSET, keysets, cursors, and behavior under concurrent writes, see Data pagination.
From page arrangement to navigation
Long before software, pagination belonged to print. Merriam-Webster defines the word as numbering and arranging book pages and traces its earliest English usage to 1794.1
Interfaces borrow that print metaphor to show where you are and where you can go next, though the underlying target shifts: a book's page number points to a fixed physical leaf, whereas a search-result page points to a slice of a live collection shaped by filters and sort order.
Previous and next document relations (1999)
HTML 4.01, published on December 24, 1999, brought those sequential links into standard markup by defining Next and Prev relations for ordered documents, laying the groundwork for rel="next" and rel="prev" today.2
List navigation as an interaction pattern
In interaction design, Martijn van Welie's pattern library frames Paging as a practical way to browse a large set without overwhelming the screen, pairing fixed-size chunks with explicit controls to move between them.3
Lumping database query plans into that same pattern muddies both sides. Clicking page three and scanning for the next twenty rows are linked events, yet they change for different reasons and answer to different review criteria.
Communicating the current location (2017)
Visual styling alone leaves blind and low-vision users guessing. Released in 2017, the WAI-ARIA 1.1 Recommendation introduced aria-current, with aria-current="page" specifically marking the active page in a navigation set, so assistive technologies can announce the user's location instead of relying on color or a border.4
Numbered pages, load more, and infinite scrolling
Numbered pages shine when people need to bookmark a specific slice or share its URL. “Load more” hands timing to the user, and infinite scrolling keeps appending items as the viewport nears the bottom; whichever model you pick, you still have to decide how current location is communicated, how filters persist, and where keyboard focus lands when new items appear.
The GOV.UK Design System likewise omits pagination controls when every item fits on one page and advises against infinite scrolling because it traps keyboard focus and pushes footers out of reach.5
Example: accessible pagination markup
Take fifteen search results shown five per page: page two renders items six through ten, while Previous and Next point to pages one and three:
<nav aria-label="Search result pages">
<a href="/search?q=typescript&page=1" rel="prev">Previous</a>
<a href="/search?q=typescript&page=1" aria-label="Page 1">1</a>
<a href="/search?q=typescript&page=2" aria-label="Page 2" aria-current="page">2</a>
<a href="/search?q=typescript&page=3" aria-label="Page 3">3</a>
<a href="/search?q=typescript&page=3" rel="next">Next</a>
</nav>Every link keeps the query parameter q intact while stepping page. Meanwhile, aria-current="page" singles out page two for screen readers alongside visual CSS.
In production, the router still has to bind those URL parameters to the rendered slice, guard against out-of-range page numbers, and restore focus and scroll position on browser Back navigation.
Truncating page ranges with fixed slots
When a collection spans dozens or hundreds of pages, rendering every page link in a single row overwhelms the navigation bar. Most interfaces keep the first page (1), the last page (totalPages), and immediate neighbors around the active page while collapsing distant stretches into ellipses (…) so the reader still sees both local position and total scale.
Keeping the total number of visible slots constant across middle pages stops the control bar from growing and shrinking as the user steps through results, so the Previous and Next links stay under the pointer. Because an ellipsis marks a gap rather than a destination, it belongs in non-interactive text so keyboard Tab navigation moves straight between real page links.
Resetting and clamping page state when filters change
Changing a filter or search query while standing on page four can shrink the result set enough that page four no longer exists. Resetting the active page to 1 whenever filter criteria change, and clamping incoming URL page numbers to 1..totalPages, prevents bookmarks or narrowed filters from stranding the reader on an empty slice.
type PageSlot = number | 'ellipsis';
function clampPage(page: number, totalItems: number, pageSize: number): { page: number; totalPages: number } {
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
const bounded = Math.min(Math.max(1, Math.trunc(page)), totalPages);
return { page: bounded, totalPages };
}
function buildSlots(current: number, totalPages: number): PageSlot[] {
if (totalPages <= 7) {
return Array.from({ length: totalPages }, (_, i) => i + 1);
}
if (current <= 4) {
return [1, 2, 3, 4, 5, 'ellipsis', totalPages];
}
if (current >= totalPages - 3) {
return [1, 'ellipsis', totalPages - 4, totalPages - 3, totalPages - 2, totalPages - 1, totalPages];
}
return [1, 'ellipsis', current - 1, current, current + 1, 'ellipsis', totalPages];
}
const clamped = clampPage(9, 42, 10);
console.log(`${clamped.page}/${clamped.totalPages}`);
console.log(buildSlots(1, 10).join(' '));
console.log(buildSlots(5, 10).join(' '));
console.log(buildSlots(9, 10).join(' '));5/5
1 2 3 4 5 ellipsis 10
1 ellipsis 4 5 6 ellipsis 10
1 ellipsis 6 7 8 9 10Requesting page 9 across 42 items at 10 per page clamps the active page to 5/5, and across a 10-page list buildSlots always returns seven slots whether the reader is near the start (1), in the middle (5), or near the end (9). Only the placement of ellipsis shifts between one gap and two, keeping the navigation bar width steady across page transitions.
See also
Footnotes
- Merriam-Webster, “pagination”, senses 1–2 and Word History. Dictionary entry. ↩
- W3C, HTML 4.01 Specification, December 24, 1999, §6.12 Link types, Next and Prev. Specification, link relations. ↩
- Martijn van Welie, “Paging”, Interaction Design Pattern Library, Problem, Solution, and Use when. Author's pattern description. ↩
- W3C, Accessible Rich Internet Applications (WAI-ARIA) 1.1, Recommendation, December 14, 2017, aria-current. Dated specification. ↩
- GOV.UK Design System, “Pagination”, When to use, How it works, and HTML example. Official design guidance. ↩