Navigation

Pagination

Navigate through paged content with previous/next controls, page numbers, and ellipsis indicators. Supports keyboard navigation, edge buttons, and bindable page state.

Playground

Experiment with different props in real-time.

Current page: 1

Basic Usage

Pass a total count to render pagination controls.

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

<Pagination total={100} />

Sizes

Use the size prop to change the pagination dimensions.

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

Set the activeColor prop to change the active page indicator 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" />

Show Edges

Enable showEdges to display first and last page buttons (« and »).

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

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

With Sibling Count

Control how many pages appear on each side of the current page with siblingCount.

<Pagination total={200} siblingCount={2} />

Disabled

Disable all interaction with the pagination controls.

<Pagination total={100} disabled />

Controlled

Use bind:page to control and display the current page.

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 between pages
ellipsisIconIcon inside ellipsis indicator
prevPrevious page button
prevIconIcon inside previous page button
nextNext page button
nextIconIcon inside next page button
firstFirst page button
firstIconIcon inside first page button
lastLast page button
lastIconIcon inside last page button

Snippets

Use Svelte 5 snippets to customize specific parts of the Pagination.

SnippetTypeDescription
firstSlotSnippetCustom first page button content
prevSlotSnippetCustom previous page button content
nextSlotSnippetCustom next page button content
lastSlotSnippetCustom last page button content
ellipsisSlotSnippetCustom ellipsis indicator content
itemSlotSnippetCustom individual page button content

Props

PropTypeDefault
pagenumber1
defaultPagenumber1
totalnumber0
itemsPerPagenumber10
siblingCountnumber1
showEdgesbooleanfalse
showControlsbooleantrue
disabledbooleanfalse
onPageChange(page: number) => void-
size'xs' | 'sm' | 'md' | 'lg' | 'xl''md'
activeColorColor'primary'
firstIconstring'lucide:chevrons-left'
prevIconstring'lucide:chevron-left'
nextIconstring'lucide:chevron-right'
lastIconstring'lucide:chevrons-right'
ellipsisIconstring'lucide:ellipsis'
classstring-
uiRecord<Slot, Class>-