Pagination group
Moves between the pages of a list or table with a known number of pages.
Default
Pages before and after the current one, with the first and last page always in reach.
Middle page
Away from the edges, ellipses replace the pages on both sides.
Last page
The next button is disabled on the last page.
Few pages
When the current page and its neighbors reach both ends, no ellipsis is needed.
Guidelines
- Use a pagination group when you know the total number of pages. It does not fit cursor-based pagination, where the total is unknown.
-
Pass
page_patcha function that takes a page number and returns the path to that page, usually the current query with the page parameter replaced. -
Name the page parameter after the list it paginates, such as
test-runs-page, so several paginated lists can share a page. - Render the group only when there is more than one page.
- The previous and next buttons are disabled on the first and last page. Long ranges collapse into ellipses around the current page.
API reference
<.pagination_group>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
current_page
Required
|
integer
|
–
|
The current page number.
|
|
number_of_pages
Required
|
integer
|
–
|
The number of pages to display.
|
|
page_patch
Required
|
fun
|
–
|
Get a patch for an individual page where the input is the index.
|
Also accepts global attributes.