Page Navigation Methods
Methods for navigating between pages, checking boundaries, and generating page lists.
nextPage()
nextPage(): number | nullReturns the next page number, or null if already on the last page.
playground.ts
prevPage()
prevPage(): number | nullReturns the previous page number, or null if already on the first page.
playground.ts
isFirstPage()
isFirstPage(): booleanReturns whether the current page is the first page.
playground.ts
isLastPage()
isLastPage(): booleanReturns whether the current page is the last page.
playground.ts
hasPrevPage()
hasPrevPage(): booleanReturns whether a previous page exists.
playground.ts
hasNextPage()
hasNextPage(): booleanReturns whether a next page exists.
playground.ts
firstPage()
firstPage(): numberReturns the first page number (always 1).
playground.ts
lastPage()
lastPage(): numberReturns the last page number.
playground.ts
pageList()
pageList(options?: PageListOptions): number[]Generates an array of page numbers for UI display.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | PageListOptions (optional) | Configuration for page list generation. |
interface PageListOptions {
edgeCount?: number; // default: 1
siblingCount?: number; // default: 1
}Behavior
- Always shows first/last
edgeCountpages. - Shows
siblingCountpages around current page. - Merges overlapping ranges.
Example
playground.ts
Last updated: Sun, Jun 14, 2026 07:15:25PM (UTC)
