Skip to Content
zjkm-ui
Components

Page Jump

Pagination with a box to jump to any page.

Props
<PageJump page={page} total={40} onChange={setPage} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/page-jump.json
import { PageJump } from "@/components/page-jump"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

Previous and Next with a box to type any page number and press Enter. Numbers outside the range are clamped to the first or last page.

import { PageJump } from "@/components/page-jump";

export function Archive() {
  const [page, setPage] = useState(1);
  return <PageJump page={page} total={40} onChange={setPage} />;
}

Props

PropTypeDefaultDescription
pagenumberThe current page, from 1.
totalnumberNumber of pages.
onChange(page: number) => voidCalled with the new page.
labelstring"Pagination"Accessible name.
classNamestringClasses for the nav.

It has no animation, so reduced motion changes nothing.

On this page