Pagination
Navigate a result set by page using state or destinations.
Use Pagination when a result set has a known page count. The application owns data fetching and the mapping from page numbers to URLs or controlled state.
Basic usage#
Playground#
Anatomy#
Usage#
Current page#
Use page with onPageChange for controlled navigation. total is the number of records, not the page count; the component derives the page count from itemsPerPage. The surrounding application owns data fetching and URL updates.
Rendering links#
Use to(page) by itself to render enabled page controls as anchors. For router integration, use itemAs for numbered items and controlAs for Previous/Next; these props are independent and to still only generates the destination. This example uses Solid Router’s A and useSearchParams to keep the current page synchronized with destinations such as /pagination?page=2. Boundary Previous/Next controls remain native disabled buttons even when controlAs is set.
Keyboard interaction#
Pagination does not add collection-style arrow navigation. Each interactive page control uses the keyboard semantics of its rendered button, link, or custom polymorphic element.
Examples#
Controlled page#
Page size and results#
Keep the requested page within the new page count when users change how many results are shown.
Attributes#
data-disabledSlot: pagination-item, pagination-prev, pagination-nextDescription: Present when the component, slot, or item is disabled.data-loadingSlot: pagination-item, pagination-prev, pagination-nextDescription: Present when the component or async operation is loading.data-textSlot: pagination-prev, pagination-nextDescription: Present when the input group part contains text.data-currentSlot: pagination-itemDescription: Present when the item represents the current location or step.data-ellipsisSlot: pagination-ellipsisDescription: —Props#
Props for the Pagination component. Renders a <nav> element by default.