Overview
Reference usage
Page-navigation control for stepping through multi-page result sets.
Usage
When the total page count is unknown, omit totalPages and pass the direction availability you know:
This renders the current page and previous/next controls without implying a fake final page.
REST Link headers
Cursor pagination
Pass onPrevious and onNext to put the component in callback mode. The caller keeps the offset or cursors and is told when the user asks for the previous or next page; the component never changes currentPage.
Callback mode
Giving onPrevious or onNext enables callback mode, which serves offset and cursor paging:
- Activating Previous or Next calls the callback with no arguments and leaves
currentPageunchanged. - Previous is enabled when
onPreviousis given andhasPreviousPageis true, and Next whenonNextis given andhasNextPageis true, so a list opened partway through can still go back. A direction with no callback stays disabled. - No page-number buttons render. When
totalPagesis given, a "Page N of M" label shows between the buttons, usingcurrentPage(default 1) for N; cursor paging without a total can omitcurrentPage. - Without either callback, rendering and behavior are unchanged.
Custom count text
countLabel replaces the default "N results" text shown for totalCount. It receives the raw count, so format it yourself.
Page 1 of 10
When to use
- Moving through a large, ordered dataset split into discrete pages of fixed size.
- Showing the current page in context of the total page count.
- Switching between named sibling views — use tabs instead.
- Streaming results as the user scrolls — wire up infinite scroll directly.
Examples
Basic pagination
Navigate through pages with previous/next and numbered buttons.
Cursor pagination
Callback mode: the caller keeps the cursors and Pagination reports when the user asks for the previous or next page, without changing currentPage.
REST Link-header pagination
Drive previous and next buttons from parsed REST Link headers without a total page count.
Pagination with total count
totalCount prop shows formatted record count.
Props
Name | Type | Default | Description |
|---|---|---|---|
currentPage bindable | number | 1 | Current page number (1-indexed). Bindable. In callback mode it only feeds the "Page N of M" label, so cursor paging can omit it. |
totalPages | number | Total number of pages. Omit when only previous/next availability is known. | |
hasPreviousPage | boolean | Whether a previous page is available. When totalPages is unknown, defaults to currentPage > 1.
In callback mode (onPrevious or onNext given) Previous is enabled only when onPrevious is
given and this is true. | |
hasNextPage | boolean | false | Whether a next page is available. When totalPages is unknown, defaults to false. In callback
mode (onPrevious or onNext given) Next is enabled only when onNext is given and this is
true. |
totalCount | number | Optional total record count; formatted with formatNumber when provided. | |
countLabel | (count: number) => string | Formats the totalCount text in place of the default "N results". Receives the raw count,
so format it with your own locale rules. | |
onPrevious | () => void | Called when the user asks for the previous page. Giving this or onNext puts the component
in callback mode: currentPage is never changed by the component, Previous is enabled when
this is given and hasPreviousPage is true, and no page-number buttons render. Keep the offset
or cursor in the caller. | |
onNext | () => void | Called when the user asks for the next page. Giving this or onPrevious puts the component
in callback mode: currentPage is never changed by the component, Next is enabled when this
is given and hasNextPage is true, and no page-number buttons render. When totalPages is given the
controls show "Page N of M". |