Navigation · Pagination
Pagination
The Pager helps users navigate between multiple pages
Demos
How to import
Basic Usage
Set the total number via
Total
, Set capacity per page via pageSize
.disabled
Disabled via the
disabled
settingShow total page number
Use the showTotal property to control whether the total number of pages is shown.
Specify current page number
You can specify the currently active page number via
defaultCurrentPage
.Capacity switching per page
By setting
showSizeChanger
for true
, allowing quick switching of capacity per page via the Select componentJump to a page quickly
By setting
When Input loses focus, if there is a valid number in Input, it will jump directly. You can also enter the page number you want to jump to when the Input is focused, and then hit enter to jump directly
If you enter a page number greater than the total page number of the pager, we will automatically jump to the last page for you
showQuickJumper is available after v1.31
showQuickJumper
to true
, you can enter the page number through the Input control to quickly jumpWhen Input loses focus, if there is a valid number in Input, it will jump directly. You can also enter the page number you want to jump to when the Input is focused, and then hit enter to jump directly
If you enter a page number greater than the total page number of the pager, we will automatically jump to the last page for you
showQuickJumper is available after v1.31
Page number controlled
After the currentPage is passed in, the pager is a controlled component and is generally used in conjunction with
onPageChange
. The current active page number depends entirely on the value of the currentPage
passed in.Preset capacity per page
Specify an optional value for switching the capacity per page by using the
pageSizeOpts
arrayMini version
Show mini pagination via size properties.
Turn on hoverShowPageSelect to quickly switch hover page numbers (provided after v1.27.0)
API reference
Properties | Instructions | type | Default | Version |
---|---|---|---|---|
className | The CSS class name of the wrapper element | string | ||
currentPage | Current page number | number | ||
defaultCurrentPage | Default current page number | number | ||
hideOnSinglePage | Whether to hide the page divider automatically when the total number of pages is less than 2. When showSizeChanger is true, this switch no longer takes effect | boolean | false | |
disabled | disabled | boolean | false | 2.37.0 |
hoverShowPageSelect | Whether to show the page select when hover page (only work when size='small') | boolean | false | 1.27.0 |
nextText | Text displayed by the next Page button | string| React Node | ||
pageSize | Number of entries per page | number | 10 | |
pageSizeOpts | Specify how many items are displayed per page | array | [10, 20, 40, 100] | |
popoverPosition | Floating layer direction, visible Popover·API reference·position | string | "bottomLeft" | |
popoverZIndex | Floating layer z-index value | number | 1030 | |
prevText | Text displayed by the previous Page button | string| React Node | ||
size | Size, optional small , default | string | 'default' | |
style | Inline style | object | ||
showSizeChanger | Whether to show a selector to switch the capacity of each page | boolean | false | |
showQuickJumper | Whether to show a input to type the page number, supported after v1.31 | boolean | false | 1.31.0 |
showTotal | Whether to show total page number | boolean | 3 | |
total | Total number | number | 1 | |
onChange | The callback function when page number or capacity per page changes | function(currentPage: number, pageSize: number) | ||
onPageChange | A callback function for page number changes | function(currentPage: number) | ||
onPageSize Change | Callback function when capacity changes per page | function(pageSize: number) |
Accessibility
ARIA
aria-label
: Labels the element such as previous, next, pages in the pagination.aria-current
: Indicates the current page.
Design Tokens
FAQ
- Why is the page drop-down selector only
1,000,000
at most?
Because when creating lists, the browser has restrictions on the size of Array.from () to create arrays; At the same time, in order to take into account the overhead of Array.from(), we set the threshold of1,000,000
.