Skip to Content
Documentation
Saas UI
Get Pro
Getting started
Components
Overview

Pagination

Used to navigate through a series of pages.

SourceStorybookArk

Anatomy

import { Pagination } from '@saas-ui/react/pagination'
<Pagination.Root>
  <Pagination.PrevTrigger />
  <Pagination.Items />
  <Pagination.PageText />
  <Pagination.NextTrigger />
</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
defaultPage '1'
number

The initial active page when rendered. Use when you don't need to control the active page of the pagination.

defaultPageSize '10'
number

The initial number of data items per page when rendered. Use when you don't need to control the page size of the pagination.

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.
count
number

Total number of data items

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

page
number

The controlled active page

pageSize
number

The controlled number of data items per page

translations
IntlTranslations

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

Previous

Page

Next

Password Input