Docs
Pagination
A pagination component for navigating through pages of data.
Installation
pnpm dlx shadcn@latest add https://devkit.kiron.dev/k/pagination
Usage
import { Pagination } from "@/components/ui/pagination"
export function Component() {
const page = parseInt(searchParams.get("page") || "1")
const pageSize = parseInt(searchParams.get("pageSize") || "20")
const [data, count] = await getDataWithCount()
return (
<div>
<Pagination page={page} pageSize={pageSize} totalCount={count} />
</div>
)
}Examples
With One Item
With Page Size Options
Rows per page
With Page Size Options and One Item
Rows per page
Props
| Prop | Type | Default | Description |
|---|---|---|---|
page | number | 1 | The current page number. |
pageSize | number | 20 | The number of items per page. |
totalCount | number | 0 | The total number of items. |
pageSearchParam | string | "page" | The name of the search parameter for the page number. |
pageSizeSelectOptions | { pageSizeSearchParam?: string; pageSizeOptions: number[] } | { pageSizeOptions: [10, 20, 50] } | Configuration for the page size select options. |