Skip to content
Pixelbits
Docs / Pagination
Data display

Pagination

Page navigation for long lists, in the kit's pixel style: square cells with cut pixel corners, the pixel dissolve on hover and focus, the current page filled with the accent, pixel arrows and a dotted gap. The current page is marked with aria-current="page"; previous/next are disabled at the ends.

Installation

npm: import
import { Pagination } from "pixelbits/pagination";
shadcn: copy the source
npx shadcn add https://pixelbits.ali-moradi-develop.com/r/pagination.json

API

<Pagination>

Page navigation for long lists, in the kit's pixel style: square cells with cut pixel corners, the pixel dissolve on hover and focus, the current page filled with the accent, pixel arrows and a dotted gap. The current page is marked with aria-current="page"; previous/next are disabled at the ends.

Example
<Pagination page={page} count={9} onPageChange={setPage} />
<Pagination page={3} count={42} href={(p) => `/blog?page=${p}`} />
PropTypeDefaultDescription
page*number—

The current page, starting at 1.

count*number—

Number of pages.

onPageChange(page: number) => void—

Called with the page the user picked (for client-side paging).

href(page: number) => string—

Builds a link for a page (for server-rendered paging, crawlable). When set, pages render as links instead of buttons.

siblingsnumber1

Pages shown on each side of the current one.

aria-labelstring"Pagination"

Accessible name of the navigation landmark.

Also accepts every prop of Omit<HTMLAttributes<HTMLElement>, "onChange">.