Skip to content

Pagination

Page navigation with first/last boundaries, sibling pages around the current page, and ellipses.

<script>
import Pagination from "@invisible-ui/svelte/Pagination.svelte";
</script>
PropTypeDefaultDescription
pagenumber1Current page. Controllable mirror: clicking a page updates it locally and reports through onPageChange; a later prop value overwrites the local choice (clamped to pageCount) without a callback. The other props keep their initial-value behaviour.
pageCount *number—
siblingCountnumber1
boundaryCountnumber1
disabledbooleanfalse
labelstring | undefinedundefinedAccessible name for the nav.
onPageChange((page: number) => void) | undefinedundefinedCalled when the page changes.
  • <nav> with a labelled list; the current page carries aria-current="page".
  • In right-to-left text Left and Right swap, so the arrows keep following the reading direction; the page’s dir is read when a key is pressed, with or without a locale provider.
<Pagination page={3} pageCount={10} onPageChange={(p) => (page = p)} />

With Elements, use attributes for configuration and listen for the bubbling change event. Its detail contains the committed page.

<ds-pagination page="3" page-count="10" label="Catalog pages"></ds-pagination>
<script type="module">
import "@invisible-ui/elements/define";
const pagination = document.querySelector("ds-pagination");
pagination.addEventListener("change", (event) => {
pagination.page = event.detail.page;
});
</script>

Use previous-label, next-label and page-label to localize the control. The page-label value supports the {page} placeholder.

In React, the control names come from the provider’s catalog (pagination.previous, pagination.next, pagination.page). When a press disables Previous or Next, focus moves to the page that is now current:

<Pagination page={page} pageCount={10} onPageChange={setPage} />

Themeable via --ds-pagination-*.