Skip to content
Mosaic
On this page

Pagination

Page controls for a paged list: the item range, an optional results-per-page select, first, previous, next and last buttons, and the page over the total. Pages start at 1.

Use for

  • moving between pages of a table or list
  • choosing how many results show per page

Practices

GuidancePractice
DoPass localized strings for every label. The defaults are English.
DoPass onPageSizeChange to show the results-per-page select. It is hidden without one.
Don’tClamp the page yourself. onChange gets a page between 1 and the last page.

API reference

Pagination

A nav labelled by label. Out-of-range page values render as the nearest valid page.

Slot: cl-pagination

PropTypeDescription
pagenumberThe current page.
totalItemsnumberThe item count across all pages.
pageSizenumberItems per page.
onChange(page: number) => voidCalled with the page the user asked for.
pageSizeOptionsnumber[]Choices in the results-per-page select. The current pageSize is always added.Default: [10, 15, 20, 100]
onPageSizeChange(pageSize: number) => voidCalled with the new page size. Shows the select when set.
hasFirstLastbooleanShows the first and last page buttons.Default: true
stepnumberPages moved by previous and next.Default: 1
disabledbooleanDisables every control.Default: false
labelstringThe nav accessible name.Default: 'Pagination'
rangeLabelstringThe range text, with {start}, {end} and {total} filled in.Default: '{start}–{end} of {total}'
pageSizeLabelstringThe select label and accessible name.Default: 'Results per page'
pageSizeLabelCompactstringThe select label when the pagination is narrow.Default: 'Show'
firstPageLabelstringThe first page button name.Default: 'First page'
previousPageLabelstringThe previous page button name.Default: 'Previous page'
nextPageLabelstringThe next page button name.Default: 'Next page'
lastPageLabelstringThe last page button name.Default: 'Last page'

Examples

A pager

TSX
<Pagination page={page} totalItems={120} pageSize={10} onChange={setPage} />