Pagination
npx shadcn add @klarhimmel/paginationCopy for AIExamples
Buttons
Links
Edges
DetailsAbout, usage, props and more
Page navigation with Previous, Next and numbered pages, as buttons or as plain links.
When to use
Use for
A list split over pages, with the current page and a way to move.
Not for
Endless feeds, or fewer than two pages (render nothing).
Pairs with
Table, lists, Cards.
Preview
Showing bookings 81 to 100
Import
Import
- Files
- pagination.tsx, in components/klarhimmel/ui/. With it: button, theme, utils. npm: lucide-react.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
page | number | required | Rounded down and clamped to the available pages; non-finite values use page 1. |
pageCount | number | required | Rounded down with a minimum of 1; non-finite values use 1. |
onPageChange | (page: number) => void | - | Buttons mode: called with the new page. |
href | (page: number) => string | - | Links mode: the URL of a page. Use this when each page is its own address (it works without script). |
siblings | number | 1 | Whole, non-negative adjacent pages; non-finite values use the default of 1. |
label | string | 'Pagination' | Accessible name of the navigation landmark. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Moves through the page links or buttons |
Enter / Space | Goes to the page |
The current page has aria-current="page". Previous and Next stay as disabled buttons at the ends. Use links when every page has its own address.
Accessibility