Pagination

Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.

Use pagination for numbered links and pagination-arrow for compact arrow controls.

Number pagination

Use this when you want numbered page links with `Previous`, `Next`, and ellipsis handling.

Page 4 of 12

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/pagination.json

Usage

usage.svelte

Props

Number pagination props

NameTypeDefaultDescription
currentPagenumberrequiredCurrent page number. Use a `1`-based value.
pageCountnumberrequiredTotal number of pages.
canPreviousPagebooleanrequiredDisable previous actions when the current page is the first page.
canNextPagebooleanrequiredDisable next actions when the current page is the last page.
onPrevious() => voidrequiredRuns when the previous control is pressed.
onNext() => voidrequiredRuns when the next control is pressed.
onGoToPage(page: number) => voidrequiredRuns with a `1`-based page number.
siblingCountnumber1How many page links to show on each side of the active page.

Arrow pagination

Use this when you want compact first, previous, next, and last controls with range details.

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/pagination-arrow.json

Usage

usage.svelte

Props

Arrow pagination props

NameTypeDefaultDescription
currentPagenumberrequiredCurrent page number. Use a `1`-based value.
pageCountnumberrequiredTotal number of pages.
canPreviousPagebooleanrequiredDisable previous actions when the current page is the first page.
canNextPagebooleanrequiredDisable next actions when the current page is the last page.
onPrevious() => voidrequiredRuns when the previous control is pressed.
onNext() => voidrequiredRuns when the next control is pressed.
onGoToPage(page: number) => voidrequiredRuns with a `1`-based page number.
siblingCountnumber1How many page links to show on each side of the active page.
firstVisibleRownumberrequiredOne-based index of the first visible row.
lastVisibleRownumberrequiredOne-based index of the last visible row.
totalRowsnumberrequiredTotal rows across all pages.
classstring""Optional class for the root navigation wrapper.

Examples

Coming soon.

Guides & blogs