Skip to Content
zjkm-ui
Components

Simple Pagination

Previous and next with the page count.

Props
<SimplePagination page={page} total={12} onChange={setPage} />

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/simple-pagination.json
import { SimplePagination } from "@/components/simple-pagination"

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 "Page 3 of 12" between them. The count is announced to screen readers when it changes.

import { SimplePagination } from "@/components/simple-pagination";

export function Feed() {
  const [page, setPage] = useState(1);
  return <SimplePagination page={page} total={12} 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