Pagination draws the controls for a list split into pages: previous and next buttons, the first and last pages, the pages around the current one, and an ellipsis for each run left out. It is a nav landmark named "Pagination" holding a list of buttons, and the current page carries aria-current="page".
Pass the number of pages as total, or the number of items as count with perPage, and Pagination works the page count out. An empty list is page 1 of 1.
The control keeps the same number of items wherever the current page is, so it does not change width as the reader pages through. boundaries sets how many pages are always drawn at each end, and siblings how many on each side of the current page. Both default to 1. An ellipsis never stands for a single page: that page is drawn instead.
showFirstLast adds buttons that jump to either end, for very long ranges where the boundary pages are not enough.
Pass page and onChange when the host owns the page, as it does when the page comes from the URL or a server request. perPageOptions adds a page-size select in front of the pages; pair perPage with onPerPageChange to own that too. When the size changes, the page moves so the first item on screen stays on screen, and onChange reports the move.
- The landmark is named "Pagination". Give each one its own aria-label when a page has more than one, and to translate it. labels translates the arrow buttons and the per-page label.
- Every control is a real button, reached with Tab. When an arrow reaches the first or last page and disables itself, focus moves to the current page instead of dropping to the document.
- disabled turns every control off, such as while the next page loads.
- Table draws its page buttons with Pagination when it is paginated.