dssoca docs
GitHub repository

Pagination

Windowed page navigator.

A page navigator with Prev/Next controls and a windowed list of page numbers: it always shows the first and last page plus `siblingCount` pages around the current one, bridging hidden runs with `…`. Give it a `pageCount`, or a `total` item count with `pageSize` to derive the count. `page` is bindable (1-based); the current page is `aria-current="page"`, visually active and inert. Mono numerals, zero radius, `--ss-line` hairlines.

Demo

live · storybook Open in Storybook

Demo loads from https://dssoca-storybook.vercel.app/. Run pnpm storybook for it to render locally.

Usage

svelte
<script>
  import { Pagination } from 'dssoca'
  let page = $state(1)
</script>

<Pagination bind:page total={240} pageSize={20} onchange={(p) => load(p)} />
<Pagination bind:page pageCount={20} siblingCount={2} />

Renders a `<nav aria-label="Pagination">` of buttons. Prev is disabled on page 1, Next on the last page; the current page button carries `aria-current="page"` and never re-fires. Ellipses are decorative (`aria-hidden`).

Props

PropTypeDefaultDescription
pagenumber1Current page, 1-based (bindable).
totalnumberTotal item count; combined with `pageSize` to derive the page count.
pageCountnumberExplicit page count; overrides the `total`/`pageSize` computation.
pageSizenumber10Items per page when deriving the count from `total`.
siblingCountnumber1Page-number buttons shown on each side of the current page.
disabledbooleanfalseDisable the whole control (every button is inert).
onchange(page: number) => voidFired when the page changes (after `page` updates).
size'sm' | 'md' | 'lg'Per-instance size override; inherits the ancestor `data-size-variant` when unset.