Components
Simple Pagination
Previous and next with the page count.
<SimplePagination page={page} total={12} onChange={setPage} />Installation
npx shadcn@latest add https://ui.zjkm.tech/r/simple-pagination.jsonimport { 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
| Prop | Type | Default | Description |
|---|---|---|---|
page | number | The current page, from 1. | |
total | number | Number of pages. | |
onChange | (page: number) => void | Called with the new page. | |
label | string | "Pagination" | Accessible name. |
className | string | Classes for the nav. |
It has no animation, so reduced motion changes nothing.