Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Pagination

Used to navigate through a series of pages.

SourceStorybookArk

Setup

If you don't already have the snippet, run the following command to add the pagination snippet

chakra snippet add pagination

The snippet includes a closed component composition for the Pagination component.

Usage

import {
  PaginationItems,
  PaginationNextTrigger,
  PaginationPageText,
  PaginationPrevTrigger,
  PaginationRoot,
} from "@/components/ui/pagination"
<PaginationRoot>
  <PaginationPrevTrigger />
  <PaginationItems />
  <PaginationPageText />
  <PaginationNextTrigger />
</PaginationRoot>

Examples

Sizes

Use the size prop to change the size of the pagination.

info
The pagination sizes are mapped to the Button component sizes.

Variants

Use the variant prop to control the variant of the pagination items and ellipsis.

The variant matches the Button component variant.

Controlled

Use the page and onPageChange props to control the current page.

Sibling Count

Use siblingCount to control the number of sibling pages to show before and after the current page.

Compact

Use the PaginationPageText to create a compact pagination. This can be useful for mobile views.

Use the getHref prop to create a pagination that navigates via links. This will use the LinkButton component to create the links.

info
Edit the LinkButton component to point to the correct framework link component if needed.

Attached

Here's an example of composing the pagination with the Group component to attach the pagination items and triggers.

Count Text

Pass format=long to the PaginationPageText component to show the count text

Data Driven

Here's an example of controlling the pagination state and using the state to chunk the data.

Lorem ipsum dolor sit amet 1

Lorem ipsum dolor sit amet 2

Lorem ipsum dolor sit amet 3

Lorem ipsum dolor sit amet 4

Lorem ipsum dolor sit amet 5

Props

Root

PropDefaultType
count *
number

Total number of data items

page '1'
number

The active page

pageSize '10'
number

Number of data items per page

siblingCount '1'
number

Number of pages to show beside active page

type '\'button\''
'button' | 'link'

The type of the trigger element

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
defaultPage
number

The initial page of the pagination when it is first rendered. Use when you do not need to control the state of the pagination.

ids
Partial<{ root: string ellipsis(index: number): string prevTrigger: string nextTrigger: string item(page: number): string }>

The ids of the elements in the accordion. Useful for composition.

onPageChange
(details: PageChangeDetails) => void

Called when the page number is changed

onPageSizeChange
(details: PageSizeChangeDetails) => void

Called when the page size is changed

translations
IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

Previous

Number Input

Next

Password Input