Navigation

Pagination

Navigate through pages of content. Supports sizes, colors, edge buttons, sibling count, items per page, and controlled state.

Playground

Experiment with different props in real-time.

Basic Usage

Provide total to generate page controls.

<script lang="ts">
  import { Pagination } from 'sv5ui';
</script>

<Pagination total={100} />

Sizes

5 button sizes.

xs

sm

md

lg

xl

<Pagination total={100} size="xs" />
<Pagination total={100} size="sm" />
<Pagination total={100} size="md" />
<Pagination total={100} size="lg" />
<Pagination total={100} size="xl" />

Colors

Customize the active page button color.

primary

secondary

success

error

<Pagination total={100} activeColor="primary" />
<Pagination total={100} activeColor="secondary" />
<Pagination total={100} activeColor="success" />
<Pagination total={100} activeColor="error" />

Button Variants

Change the navigation button variant.

ghost

outline

soft

<!-- Ghost buttons (default) -->
<Pagination total={100} variant="ghost" />

<!-- Outline buttons -->
<Pagination total={100} variant="outline" />

<!-- Soft buttons -->
<Pagination total={100} variant="soft" />

Show Edges

Add first/last page buttons with showEdges.

Without showEdges

With showEdges

<!-- Without showEdges -->
<Pagination total={100} defaultPage={5} />

<!-- With showEdges — adds first/last buttons -->
<Pagination total={100} defaultPage={5} showEdges />

Sibling Count

Control how many pages appear adjacent to the current page.

siblingCount=1

siblingCount=2

siblingCount=3

<!-- Default siblingCount=1 -->
<Pagination total={200} defaultPage={5} />

<!-- siblingCount=2 — shows more page numbers -->
<Pagination total={200} defaultPage={5} siblingCount={2} />

<!-- siblingCount=3 -->
<Pagination total={200} defaultPage={5} siblingCount={3} />

Items Per Page

Control how many items each page represents.

10 per page → 10 pages

20 per page → 5 pages

5 per page → 20 pages

<!-- 10 items per page (default) — 10 total pages -->
<Pagination total={100} itemsPerPage={10} />

<!-- 20 items per page — 5 total pages -->
<Pagination total={100} itemsPerPage={20} />

<!-- 5 items per page — 20 total pages -->
<Pagination total={100} itemsPerPage={5} />

Disabled

Disable all pagination controls.

<Pagination total={100} disabled />

Controlled

Use bind:page for two-way binding.

Current page: 1

<script lang="ts">
  import { Pagination } from 'sv5ui';

  let page = $state(1);
</script>

<p>Current page: {page}</p>
<Pagination total={100} bind:page />

UI Slots

Use the ui prop to override classes on internal elements.

SlotDescription
rootRoot pagination container
listPage items list wrapper
itemIndividual page button
ellipsisEllipsis indicator
firstFirst page button
prevPrevious page button
nextNext page button
lastLast page button

Snippets

SnippetPropsDescription
itemSlotpage, selectedCustom page button
firstSlotpage, disabledCustom first page button
prevSlotpage, disabledCustom previous button
nextSlotpage, disabledCustom next button
lastSlotpage, disabledCustom last page button
ellipsisSlot-Custom ellipsis indicator

Props

PropTypeDefault
pagenumber1
totalnumber0
itemsPerPagenumber10
siblingCountnumber1
showEdgesbooleanfalse
showControlsbooleantrue
disabledbooleanfalse
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'
variantButtonVariant'ghost'
colorButtonColor'surface'
activeVariantButtonVariant'solid'
activeColorButtonColor'primary'
onPageChange(page) => void-
refHTMLElement | nullnull
classstring-
uiRecord<Slot, Class>-