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.
<nav class="govuk-pagination" aria-label="results">
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
</a>
</div>
<ul class="govuk-pagination__list">
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
1
</a>
</li>
<li
class="govuk-pagination__item govuk-pagination__item--current"
>
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
2
</a>
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
3
</a>
</li>
</ul>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
</a>
</div>
</nav>
<Pagination
currentPage={2}
links={["#", "#", "#"]}
/>
Props
|
| string | - | 'id' attribute to place on the base HTML element |
| string | - | Block name override in BEM style classes applied to all elements |
| Modifiers | - | BEM style modifiers to apply to the base HTML element |
| string | - | Extra classes to apply to the base HTML element |
| string | results | The label for the navigation landmark that wraps the pagination. |
| number | - | The current page being viewed |
| string | NextPrevProps | - | A link to the next page, if there is a next page. |
| string | NextPrevProps | - | A link to the previous page, if there is a previous page. |
| number | - | The total number of pages |
| (string | EnhancedLinkProps)[] | - | REQUIRED. List of all links to paginate through, in order |
| boolean | - | Whether to only show next and previous links |
| string | - | A link to the next page, if there is a next page. |
| string | - | A link to the previous page, if there is a previous page. |
| string | page | Query parameter to use for the page number |
| object | {} | 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:
<nav
class="govuk-pagination govuk-pagination--block"
aria-label="results"
>
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
1 of 3
</span>
</a>
</div>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
3 of 3
</span>
</a>
</div>
</nav>
<Pagination
currentPage={2}
next="#"
previous="#"
totalPages={3}
/>
Add link labels to describe pages
You can use link labels to give more context:
<nav
class="govuk-pagination govuk-pagination--block"
aria-label="results"
>
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
Applying for a provisional lorry or bus
licence
</span>
</a>
</div>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
Driver CPC part 1 test: theory
</span>
</a>
</div>
</nav>
<Pagination
next={{
href: "#",
labelText: "Driver CPC part 1 test: theory",
}}
previous={{
href: "#",
labelText:
"Applying for a provisional lorry or bus licence",
}}
/>
You can also do this through providing a list of links:
<nav
class="govuk-pagination govuk-pagination--block"
aria-label="results"
>
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
Driver CPC part 1 test: theory
</span>
</a>
</div>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<span class="govuk-visually-hidden">:</span>
<span class="govuk-pagination__link-label">
Applying for a provisional lorry or bus
licence
</span>
</a>
</div>
</nav>
<Pagination
backAndForth
currentPage={2}
links={[
{
href: "#",
labelText: "Driver CPC part 1 test: theory",
},
{
href: "#",
labelText: "Driver CPC part 2 test: practice",
},
{
href: "#",
labelText:
"Applying for a provisional lorry or bus licence",
},
]}
/>
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.
<nav class="govuk-pagination" aria-label="results">
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=6"
data-discover="true"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
</a>
</div>
<ul class="govuk-pagination__list">
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=1"
data-discover="true"
>
1
</a>
</li>
<li
class="govuk-pagination__item govuk-pagination__item--ellipsis"
>
⋯
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=6"
data-discover="true"
>
6
</a>
</li>
<li
class="govuk-pagination__item govuk-pagination__item--current"
>
<a
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=7"
data-discover="true"
>
7
</a>
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=8"
data-discover="true"
>
8
</a>
</li>
<li
class="govuk-pagination__item govuk-pagination__item--ellipsis"
>
⋯
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=42"
data-discover="true"
>
42
</a>
</li>
</ul>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-pagination__link"
href="/?name=Pagination&p=8"
data-discover="true"
>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
</a>
</div>
</nav>
<Pagination
currentPage={7}
pageParameter="p"
query={{
name: "Pagination",
}}
totalPages={42}
/>
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.
<nav class="govuk-pagination" aria-label="results">
<ul class="govuk-pagination__list">
<li
class="govuk-pagination__item govuk-pagination__item--current"
>
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
1
</a>
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
2
</a>
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
3
</a>
</li>
</ul>
<div class="govuk-pagination__next">
<a
rel="next"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<span class="govuk-pagination__link-title">
Next
<span class="govuk-visually-hidden">
page
</span>
</span>
<svg
class="govuk-pagination__icon govuk-pagination__icon--next"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m8.107-0.0078125-1.4136 1.414 4.2926 4.293h-12.986v2h12.896l-4.1855 3.9766 1.377 1.4492 6.7441-6.4062-6.7246-6.7266z"
></path>
</svg>
</a>
</div>
</nav>
<Pagination
currentPage={1}
links={["#", "#", "#"]}
/>
<nav class="govuk-pagination" aria-label="results">
<div class="govuk-pagination__prev">
<a
rel="prev"
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
<svg
class="govuk-pagination__icon govuk-pagination__icon--prev"
xmlns="http://www.w3.org/2000/svg"
height="13"
width="15"
aria-hidden="true"
focusable="false"
viewBox="0 0 15 13"
>
<path
d="m6.5938-0.0078125-6.7266 6.7266 6.7441 6.4062 1.377-1.449-4.1856-3.9768h12.896v-2h-12.984l4.2931-4.293-1.414-1.414z"
></path>
</svg>
<span class="govuk-pagination__link-title">
Previous
<span class="govuk-visually-hidden">
page
</span>
</span>
</a>
</div>
<ul class="govuk-pagination__list">
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
1
</a>
</li>
<li class="govuk-pagination__item">
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
2
</a>
</li>
<li
class="govuk-pagination__item govuk-pagination__item--current"
>
<a
class="govuk-link govuk-link--active govuk-pagination__link"
href="#"
>
3
</a>
</li>
</ul>
</nav>
<Pagination
currentPage={3}
links={["#", "#", "#"]}
/>
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.