Page navigation that keeps every button in place, glides to the current page and jumps to any page from the ellipsis.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- cn
- @base-ui/react
- @tabler/icons-react
Code
"use client"
import * as React from "react"
import { Pagination } from "@/components/ui/pagination"
const perPage = 10
const total = 248
export function PaginationDemo() {
const [page, setPage] = React.useState(1)
const first = (page - 1) * perPage + 1
const last = Math.min(page * perPage, total)
return (
<div className="flex w-full flex-col items-center gap-4">
<Pagination
page={page}
count={Math.ceil(total / perPage)}
onPageChange={setPage}
/>
<p className="text-sm text-muted-foreground tabular-nums">
Showing {first}–{last} of {total} results
</p>
</div>
)
}
































