Skip to contentKino
Skip to Content

Pagination

Previous, Next and the pages between them, as buttons or links. The pill slides to the current page and the numbers roll as the range moves.

npx shadcn add https://kinoui.com/r/pagination.json
Share on

Examples

Invoices

InvoiceCustomerAmount
KN-1048Halcyon Labs$240.00
KN-1047Fjord Supply$1,613.50
KN-1046Kestrel & Co.$2,987.00
KN-1045Parcel Post$4,359.00
KN-1044Brightline$5,732.50

1–5 of 60

Default

Hold the page, and show the rows that go with it. The pill slides to the page you pick, and a backdrop follows the pointer.

Events 721–740 of 4,800

Many pages

An ellipsis stands for each run of pages between the ends and the current one. The row keeps its width, so the numbers roll past the pill.

Password reset

Use the link we just sent to choose a new password. It works for an hour.

Narrow

Short of room, Previous and Next keep only their arrows. A row still too wide shows fewer pages around the current one.

Installation

npx shadcn@latest add https://kinoui.com/r/pagination.json
Files
lib/controllable.tslib/reduce-motion.tslib/resize.tslib/run-progress.tslib/highlight.tslib/pill.tslib/refs.tslib/roll.tsxlib/swap.tsxcomponents/kino/pagination.tsx

New to Kino? Installation covers what your project needs first and the @kino namespace.

API reference

Pagination

PropTypeDefaultDescription
pageCountnumberNoneHow many pages there are. Below 1, it shows one page.
pagenumberNoneThe current page, counted from 1, when you hold the state.
defaultPagenumber1The page it opens on, when it holds its own state.
onPageChange(page) => voidNoneCalled with the page a person picks. A link opened in a new tab or window doesn’t call it.
siblingsnumber1How many pages show on each side of the current one, at most.
boundariesnumber1How many pages show at each end, at most. With 0 the row is a window of pages, with no ellipses.
href(page) => stringNoneMakes every page, and Previous and Next, a link to that address.
renderLink(props) => ReactElementNoneDraws each link, such as with your router’s Link. Pass it every prop; one that can’t go anywhere has no href.
aria-labelstring'Pagination'The landmark’s name. Name each one on a page that has several.

PaginationPages

PropTypeDefaultDescription
pageLabel(page, of) => string`Page ${page}`Each page’s accessible name, such as in another language. of is the page count, given for the current page only: Page 6 of 18.

Data attributes

AttributeOnDescription
aria-currentthe current pagepage on the current page’s button or link.
data-disabledPaginationPrevious, PaginationNextPresent on the first page for Previous and on the last for Next.

Accessibility

  • It is a nav landmark, named Pagination unless you give aria-label. Name each one when a page has several.
  • Each page is a button, or a link with href, named Page 4, and the current one Page 6 of 18, so the count is known even when the last page doesn’t show: the number rolls for the eye, and the name is read whole. The current one has aria-current="page".
  • Previous on the first page and Next on the last stay in the tab order with aria-disabled, so focus isn’t lost when you reach an end. When only their arrows show, their words are still their names.
  • The ellipses are hidden from screen readers: the pages around them say where you are.
  • A page you press can roll to another place as the range moves: focus goes with it.
  • In forced colours the pill takes the system highlight, and a disabled Previous or Next turns GrayText.
  • When the system asks for less motion, the pill moves at once and the numbers change without rolling.