Pagination

Navigation

Splits long lists into navigable pages with numbered buttons.

Pagination always shows the first and last page plus a window around the current page, with ellipsis markers for the gaps in between.

npx shadcn@latest add pagination

Default

Step through pages with the chevrons or jump with the numbers.

Preview
Live

Page 5 of 12

tsx
1<Pagination
2 page={page}
3 pageCount={12}
4 onPageChange={setPage}
5/>

Near the start

The window slides so you always see the current page and its neighbors.

Preview
Live

The ellipsis hides the far pages.

tsx
1<Pagination page={1} pageCount={12} onPageChange={() => undefined} />

API reference

All props of the underlying Base UI primitive are forwarded. The table below documents the Shelf-specific props.

PropTypeDescription
pagenumberThe currently active page, 1-indexed.
pageCountnumberThe total number of pages.
onPageChange(page: number) => voidCalled with the new page when the user navigates.
classNamestringOverride the classes of the nav wrapper.