Skip to content

Pagination

Page links with previous and next.

Pages

Previous and next only

Installation

npx shadcn@latest add @khaeli/pagination

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

npm packages
  • @keyline-icons/react ^2.2.0

Keyboard

Tab
Moves through previous, the page links and next, in order.
EnterSpace
Follow the focused link. The links are rendered through @khaeli/button, so both keys work.

Accessible name

  • Pagination is a nav landmark named "pagination". When a page has more than one, give each its own aria-label.
  • PaginationPrevious and PaginationNext are named "Go to previous page" and "Go to next page"; their visible text is hidden below 640px and the name stays. If you change text, change aria-label to match.
  • The current page link has aria-current="page". PaginationEllipsis is hidden from assistive technology.
  • There is no disabled state: on the first or last page, leave the previous or next link out.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/pagination.json