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
currentPage
number required Current page number. Use a `1`-based value.
pageCount
number required Total number of pages.
canPreviousPage
boolean required Disable previous actions when the current page is the first page.
canNextPage
boolean required Disable next actions when the current page is the last page.
onPrevious
() => void required Runs when the previous control is pressed.
onNext
() => void required Runs when the next control is pressed.
onGoToPage
(page: number) => void required Runs with a `1`-based page number.
siblingCount
number 1 How 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
currentPage
number required Current page number. Use a `1`-based value.
pageCount
number required Total number of pages.
canPreviousPage
boolean required Disable previous actions when the current page is the first page.
canNextPage
boolean required Disable next actions when the current page is the last page.
onPrevious
() => void required Runs when the previous control is pressed.
onNext
() => void required Runs when the next control is pressed.
onGoToPage
(page: number) => void required Runs with a `1`-based page number.
siblingCount
number 1 How many page links to show on each side of the active page.
pageSize
number 1 Items shown per page. Used to render the visible item range.
totalItems
number pageCount * pageSize Total items across all pages.
class
string "" Optional class for the root navigation wrapper.

Examples

Coming soon.

Guides & blogs