Pagination
A pagination component that helps users navigate through multiple pages of content. Built on top of bits-ui's Pagination for accessibility and keyboard navigation.
Import
import Pagination from "$lib/components/Pagination.svelte"; Basic Usage
A simple pagination component with customizable styles and callbacks.
...
...
Properties
Name
Type
Description
totalPages
Type
number
Default: 1
Total number of pages.
currentPage
Type
number
Default: 1
Current active page.
siblingCount
Type
number
Default: 1
Number of siblings to show on each side of the current page.
onPageChange
Type
(page: number) => void
Default: () => {}
Callback function when a page is clicked.
onPrevious
Type
() => void
Default: () => {}
Callback function when the previous button is clicked.
onNext
Type
() => void
Default: () => {}
Callback function when the next button is clicked.
buttonClass
Type
string
Default: ""
Additional classes for all buttons.
rootClass
Type
string
Default: ""
Additional classes for the root element.