Pagination

Navigation

Pages of a list: <Pagination.Root> (count, perPage, bind:page, siblingCount) is a navigation landmark (label) that draws previous, the pages (the current one marked, gaps as an ellipsis) and next. The pages are buttons that change page; load the page's data when it changes. To draw it yourself, its children snippet gets the pages: a Pagination.Content list of Pagination.Items, each a Pagination.Page or a Pagination.Ellipsis, between a Pagination.PrevButton and a Pagination.NextButton.

import { Pagination } from '@limerdev/zest';
Pagination for AI tools (llms.txt)
Use for
Paging through a long list or table the app loads a page at a time.
Don't
A short list: show it all. Loading more as the user scrolls: a "Load more" Button.

Examples

Basic

240 orders, 20 a page. Load the page's data when page changes.

Orders 1–20 of 240

Your own layout

The children snippet gets the pages and the range shown, to draw your own layout.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

Pagination.Root

Prop Type Default Description
count required number – The total number of items to be paginated.
label string the Config's `strings.pagination`, else 'Pagination' The navigation landmark's name.
loop boolean false Whether keyboard navigation should loop back to the first or last page trigger when reaching either end.
onPageChange OnChangeFn<number> – A callback function called when the page changes.
orientation "horizontal" | "vertical" "horizontal" The orientation of the pagination component. Used to determine how keyboard navigation should work between pages.
page bindable number 1 The current page number.
perPage number 10 The number of items per page.
siblingCount number 1 The number of visible items before and after the current page.

Pagination.Content

No props of its own beyond the common ones.

Pagination.Item

No props of its own beyond the common ones.

Pagination.Page

Prop Type Default Description
page required Page –

Pagination.PrevButton

No props of its own beyond the common ones.

Pagination.NextButton

No props of its own beyond the common ones.

Pagination.Ellipsis

Prop Type Default Description
label string the Config's `strings.morePages`, else 'More pages' What the ellipsis stands for, for screen readers.