Components

Pagination

Help users navigate forwards and backwards through a series of pages. For example, search results or guidance that’s divided into multiple website pages — like the GOV.UK mainstream guide format.

Props
NameTypeDefaultDescription
idstring-'id' attribute to place on the base HTML element
classBlockstring-Block name override in BEM style classes applied to all elements
classModifiersModifiers-BEM style modifiers to apply to the base HTML element
classNamestring-Extra classes to apply to the base HTML element
landmarkLabelstringresultsThe label for the navigation landmark that wraps the pagination.
currentPagenumber-The current page being viewed
nextstring | NextPrevProps-A link to the next page, if there is a next page.
previousstring | NextPrevProps-A link to the previous page, if there is a previous page.
totalPagesnumber-The total number of pages
links(string | EnhancedLinkProps)[]-REQUIRED. List of all links to paginate through, in order
backAndForthboolean-Whether to only show next and previous links
nextTextstring-A link to the next page, if there is a next page.
previousTextstring-A link to the previous page, if there is a previous page.
pageParameterstringpageQuery parameter to use for the page number
queryobject{}Query object of the current page, to append to

When to use this component

Consider using pagination when:

  • showing all the content on a single page makes the page take too long to load
  • most users will only need the content on the first page or first few pages

When not to use this component

Only break up content onto separate pages if it improves the performance or usability of your service.

Avoid using the ‘infinite scroll’ technique to automatically load content when the user approaches the bottom of the page. This causes problems for keyboard users.

Do not use this Pagination component for linear journeys — for example, where you’re asking the user to complete a form. Instead, use the [Button component] (usually a ‘Continue’ button) to let the user move to the next page — and a [Back link] to let them move to the previous page.

How it works

Add the pagination component after the content on each page that you’re paginating.

View an example of Pagination in a standard GOV.UK page template.

Do not show pagination if there’s only one page of content.

Redirect users to the first page if they enter a URL of a page that no longer exists.

For smaller numbers of pages

Use ‘Previous’ and ‘Next’ links to let users navigate through a small number of pages. Stack the links vertically, so they’re more obvious to screen magnifier users when they’re zoomed in:

Add link labels to describe pages

You can use link labels to give more context:

You can also do this through providing a list of links:

For larger numbers of pages

Use a list-type layout if users need to navigate through large numbers of pages. For example, long lists of search results.

Show the page number in the page <title> so that screen reader users know they’ve navigated to a different page. For example, ‘Search results (page 1 of 4)’.

Show an appropriate number of pages to fit the horizontal space available.

For smaller screens, show page numbers for:

  • the current page
  • previous and next pages
  • first and last pages

For larger screens, show page numbers for:

  • the current page
  • at least one page immediately before and after the current page
  • first and last pages

Use ellipses (…) to replace any skipped pages. For example:

  • [1] 2 … 100
  • 1 [2] 3 … 100
  • 1 2 [3] 4 … 100
  • 1 2 3 [4] 5 … 100
  • 1 … 4 [5] 6 … 100
  • 1 … 97 [98] 99 100
  • 1 … 98 [99] 100
  • 1 … 99 [100]

First and last pages

Do not show the previous page link on the first page — and do not show the next page link on the last page.

Filtering and sorting

Consider adding filtering or sorting options if it helps users to find what they need in a long list of pages. For example, the business support finder on GOV.UK has filtering options.

If the user filters or sorts the list of pages, apply this to the whole list (not just the current page) and redirect them back to the first page of the new results.

Set defaults to minimise how many pages most users have to click through to find what they need.

Research on this component

This component is based on similar ones developed and used successfully by the Government Digital Service, Ministry of Justice and the Home Office, and on feedback in the Design System backlog.