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

PropTypeDefaultDescription
pagenumber1The current page number.
pageSizenumber20The number of items per page.
totalCountnumber0The total number of items.
pageSearchParamstring"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.