Overview
Pagination breaks content into multiple pages, allowing users to navigate through the pages sequentially. It’s commonly used with tables, lists, and search results to improve performance and usability when dealing with large data sets. The Pagination component is composable, allowing you to build different pagination patterns based on your needs.Installation
Usage
With Links
Pagination components can render as links by using theas and href props.
With Custom Text
You can add custom text to arrow buttons using thevisibleLabel prop.
With Page Label
Props
Pagination
The pagination components (typically PaginationItems).
Accessible label for the pagination navigation, used as the aria-label.
Overrides the default element name to apply unique styles with the Customization Provider.
PaginationItems
The pagination child components (arrows, numbers, etc.).
Overrides the default element name to apply unique styles with the Customization Provider.
PaginationArrow
Determines which arrow icon to display and positioning.
Accessible label describing the arrow action, used as the title for the icon.
Optional visible text to display alongside the arrow icon.
Whether the arrow button is disabled (e.g., when on the first or last page).
Whether to render as an anchor or button element.
URL to navigate to when rendered as an anchor (requires
as="a").Overrides the default element name to apply unique styles with the Customization Provider.
PaginationNumbers
PaginationNumber and PaginationEllipsis components.
Optional label text to display before page numbers (e.g., “Page”).
Overrides the default element name to apply unique styles with the Customization Provider.
PaginationNumber
The page number to display.
Accessible label for the page number, used as the aria-label (e.g., “Go to page 1”).
Whether this is the current page. Applies current page styles and sets
aria-current="page".Whether to render as an anchor or button element.
URL to navigate to when rendered as an anchor (requires
as="a").Overrides the default element name to apply unique styles with the Customization Provider.
PaginationEllipsis
Accessible label for the ellipsis, used as the aria-label (e.g., “Collapsed pages”).
Overrides the default element name to apply unique styles with the Customization Provider.
PaginationLabel
Content to display in the label.
Overrides the default element name to apply unique styles with the Customization Provider.
Accessibility
- The Pagination wrapper uses
<nav role="navigation">with a requiredaria-labelto identify it as a navigation landmark. - Arrow buttons include descriptive
labelprops that are used as icon titles. - The current page has
aria-current="page"and is not interactive. - All interactive elements (buttons/links) have accessible labels via the
labelprop. - Ellipsis has an
aria-labelto describe collapsed pages. - Disabled arrow buttons have
disabledattribute and appropriate styling.
Best Practices
Do
- Use pagination for large data sets to improve performance
- Always provide descriptive
labelprops for all interactive elements - Disable forward/back arrows when at the boundaries
- Mark the current page with
isCurrent - Use ellipsis to collapse many page numbers
- Consider using “Previous” and “Next” labels for better clarity
Don’t
- Don’t use pagination if all content can comfortably fit on one page
- Don’t show excessive page numbers (use ellipsis to collapse)
- Don’t make the current page clickable
- Don’t forget to provide accessible labels