Skip to content
Sign upGet access
MicrointeractionsOdometer pagerMenu

Odometer pager

Pagination whose numbers roll past like an odometer.

Jump from page 5 to 19 and the middle numbers roll past like wheels, blurred by their speed, while the pill stretches over.

Jump far, by typing a page or clicking the end, and the three middle numbers roll past like wheels, staggered left to right, blurred by their own speed, settling a hair past the mark and back. The dark pill stretches toward the new page, its leading edge first, and squashes with the reel it rides on; the numbers inside it are a second, inverted copy clipped to the pill, so they flip colour cleanly as it passes over.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/odometer-pager.json

Usage

tsx
import { OdometerPager } from "@/components/ui/chatcn/odometer-pager"

<OdometerPager page={page} pageCount={24} onPageChange={setPage} />

Made for seven pages or more, where the middle window moves.

Props

PropTypeNotes
page / onPageChangenumber1 based
pageCountnumber
goTobooleanThe Go to field; default true

Keyboard

KeyAction
Enter in Go toJump to that page

Accessibility

  • A labelled nav with real buttons; the current page carries aria-current.

Motion

  • Reels roll 420 ms for a step and up to about a second for a far jump, 55 ms apart. Reduced motion: numbers and pill jump.