Pagination
The <nys-pagination>
provides users with the ability to to navigate through a large set of content or data that has been divided into smaller, more manageable sections or "pages."
<nys-pagination currentPage="2" totalPages="7"></nys-pagination>
Can't use NYSDS web components in your project? Try using the CSS Variables instead.
Options
Small Screens
The <nys-pagination>
component automatically renders in a condensed format on small screens.
Note: If totalPages is 1 then the <nys-pagination>
component will not be visible.
Current Page
The prop currentPage
takes in the page number you are currently on. This value cannot be larger than the value of totalPages. If a value larger than totalPages is passed in, it will return the last available page. The default value is 1.
Total Pages
The prop totalPages
takes in the number of total pages to view.
Usage
When to use this component
- When displaying large data sets or search results that would be overwhelming to display all at once
- When users need control and orientation to navigate to a specific part of the content, such as page 5 of search results
- When performance and load times matter, since pagination lets you fetch and render smaller chunks of data instead of everything at once.
When to consider something else
- If the collection is shorter than 3–4 screen lengths, it’s better to display all items at once rather than using pagination.
- When you need to show progress through a series of tasks that must be completed in order—such as an onboarding process—use the
<nys-stepper>
component.
Do
- Use when content would be better to be spread across multiple pages.
- When there is too much content to display all at once.
- For tables and search results.
Don't
- If the displayed collection can fit on less than 3 or 4 pages, consider displaying all items at once and using a scroll.
- For interactive pages or collecting information, instead consider the
<nys-stepper>
Accessibility
The <nys-pagination>
component includes the following accessibility-focused features:
- Fewer buttons on a pagination interface are preferable because they minimize cognitive load, reduce visual clutter, and improve usability, especially on smaller screens. A simpler design helps users focus on the content and prevents analysis paralysis. Larger paginations use more space without proportional increases to the component’s functionality.
- Provide a clear, visible focus indicator for buttons so users can see where they are.
- Keyboard navigation support, allowing users to toggle the pages using the keyboard.
- Visual focus indicators to help users navigate the component.
Properties
Property | Type |
---|---|
id |
String |
name |
String |
currentPage |
Number |
totalPages |
Number |
CSS Variables
There are no existing CSS variables for this component. Explore existing options, or propose a new one with a Component Proposal.
Events
The <nys-pagination>
component emits one custom Javascript event:
nys-change
– Fired when thecurrentPage
value is changed.
Event details
The nys-change
event includes a detail object with the following properties:
- id (string): The id of the pagination component.
- page (integer): The new value of
currentPage
You can listen to these events using JavaScript:
Suggest a New Component
Do you have an idea for a new NYSDS web component? Look through the existing proposals in our GitHub discussions board to see if someone already proposed something similar. If not, feel free to submit one.
Edit this page on GitHub (Permissions required)
Last updated: October 8, 2025