Pagination

A navigation component that allows users to browse through pages.

Anatomy

To set up the pagination correctly, you’ll need to understand its anatomy and how we name its parts.

Each part includes a data-part attribute to help identify them in the DOM.

Examples

Learn how to use the Pagination component in your project. Let’s take a look at the most basic example:

Controlled Pagination

To create a controlled Pagination component, manage the state of the current page using the page prop and update it when the onPageChange event handler is called:

Customizing Pagination

You can customize the Pagination component by setting various props such as dir, pageSize, siblingCount, and translations. Here’s an example of a customized Pagination:

API Reference

Root

PropTypeDefault
count
number
asChild
boolean
defaultPage
number
id
string
ids
Partial<{ root: string ellipsis(index: number): string prevTrigger: string nextTrigger: string item(page: number): string }>
onPageChange
(details: PageChangeDetails) => void
page
number
pageSize
number
siblingCount
number
translations
IntlTranslations
type
'button' | 'link'"button"

Ellipsis

PropTypeDefault
index
number
asChild
boolean

Item

PropTypeDefault
type
'page'
value
number
asChild
boolean

NextTrigger

PropTypeDefault
asChild
boolean

PrevTrigger

PropTypeDefault
asChild
boolean