Pagination
Pagination is a navigation pattern that allows users to move between pages of content.
- Use a
<nav>element with anaria-labelto identify the pagination region - Wrap page controls in a
role="group"for proper semantic grouping - Use buttons when pagination triggers dynamic content updates without page reloads
- Use anchor links when pagination navigates to distinct URLs
Basic Pagination
The simplest pagination pattern uses buttons within a group:
Note: When a step isn't available yet but should be announced, use
aria-disabled="true"instead of the nativedisabledattribute to keep the element focusable and discoverable by assistive technology users. Remember thataria-disableddoes not block activation on its own, so you must also prevent activation/navigation in code (for example, in a JavaScript handler). In case you want to remove it from the tab order as well, addtabindex="-1".
<nav aria-label="Pagination">
<div role="group">
<button>Previous</button>
<button>1</button>
<button>2</button>
<button aria-current="page">3</button>
<button aria-disabled="true" tabindex="-1">Next</button>
</div>
</nav>Link-Based Pagination
For server-side rendering or distinct page URLs, use anchor elements with role="button":
Note:
disabledis not a valid attribute for<a>elements, so in this case you really need to usearia-disabled="true"instead.
<nav aria-label="Pagination">
<div role="group">
<a role="button" aria-disabled="true" tabindex="-1">Previous</a>
<a href="#page-1" role="button" aria-current="page">1</a>
<a href="#page-2" role="button">2</a>
<a href="#page-3" role="button">3</a>
<a href="#page-3" role="button">Next</a>
</div>
</nav>Accessibility Considerations
- Always include an
aria-labelon the<nav>element to identify the pagination region, as well as avoiding the need to label the[role="group"]element. - Use
aria-current="page"to indicate the current page to assistive technologies - Disable (don't hide) navigation buttons when they are unavailable (e.g., "Previous" on page 1)
- Ensure keyboard users can navigate between page controls using Tab/Shift+Tab
- Consider adding
aria-liveregions to announce page changes to screen reader users
Related
- <a> - Anchor element styling and active state semantics
- <button> - Button element styling
- <nav> - Navigation element semantics
- [aria-disabled] - Disabled state semantics
- [disabled] - Disabled state semantics
- [role="group"] - For grouping related controls