Pagination
A navigation component for splitting content across multiple pages.
Default
Shows the visible item range and the previous and next arrows. It fills its container, so it usually sits in a table footer.
Showing 21 – 30 of 248 items
With page indicator
Shows the current page and the page count between the arrows.
Showing 1 – 10 of 50 items
Arrows only
Hides the item count and keeps only the arrows.
Cursor mode
Use mode="cursor" when the API returns a next-page cursor instead of a total. Pass hasNextPage instead of limit, offset, and totalItems. The count reads Page N, and showPageIndicatorBetweenArrows has no effect.
Page 1
Loading state
isLoading disables both arrows while data is fetching.
Showing 11 – 20 of 248 items
Empty state
With zero items, the count is hidden and both arrows are disabled.
Installation
pnpm dlx shadcn@latest add @narakui/paginationAdd "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/pagination.json.
Usage
import { Pagination } from '@/components/ui/pagination';<Pagination
page={1}
limit={10}
offset={0}
totalItems={100}
onPageChange={setPage}
/>Properties
| Prop | Type | Default | Description |
|---|---|---|---|
page (Required) | number | — | The current page number (1-based). |
onPageChange (Required) | (page: number) => void | — | Called with the new page when an arrow is clicked. |
mode | 'counted' | 'cursor' | 'counted' | counted takes a total and shows the item range; cursor only knows whether a next page exists. |
limit | number | — | Number of items per page. Required in counted mode. |
offset | number | — | Number of items to skip, usually (page - 1) * limit. Required in counted mode. |
totalItems | number | — | Total number of items across all pages. Required in counted mode. |
hasNextPage | boolean | — | Whether a next page exists. Required in cursor mode. |
isLoading | boolean | false | Disables both arrows. |
showOnlyArrows | boolean | false | Show only navigation arrows without item count. |
showPageIndicatorBetweenArrows | boolean | false | Show the current page and page count between the arrows. Counted mode only. |
leftContent | ReactNode | — | Content shown before the item count. |
alignText | string | — | Set to 'end' to align the item count to the right. |
aria-label | string | 'Pagination' | Accessible name for the navigation landmark. Change it when a view has more than one. |
className | string | — | Additional CSS classes to apply to the pagination container. |