Page controls for tables and lists: the current page is a ball that hops along the row, its number rolls and ellipses open into pages.
Click meTap me
pagination, lively
Use it under a table or a list that is split into pages: orders, invoices, audit logs, search results. The current page is a ball: pressing another page charges it toward that page, on release it hops along the row, its number rolls inside it, and on the first or last page it squashes against the end of the row. When the window of pages shifts, each slot rolls its own number in place and the ball is carried back to the current page on the calm spring. For an endless feed use a "Load more" button; for two or three steps of a flow use a stepper.
pnpm dlx shadcn@latest add @motionkit-pro/paginationnpx shadcn@latest add @motionkit-pro/paginationyarn dlx shadcn@latest add @motionkit-pro/paginationbunx --bun shadcn@latest add @motionkit-pro/paginationRequires a Pro license and the @motionkit-pro registry with your token. See Installation.
import { Pagination } from "@/components/ui/pagination"
export function OrdersFooter({ page, onPage }: { page: number; onPage: (page: number) => void }) {
return <Pagination pageCount={42} page={page} onPageChange={onPage} />
}Three presets cover the usual layouts:
numbers (default): ‹ 1 … 6 7 8 … 42 ›, with siblingCount, boundaryCount and optional first
and last buttons (showEdges).compact: ‹ 3 of 12 ›, the ball under the current number. For side panels and cards.table: rows per page, the rolling range "141–160 of 812" and the arrows, for table footers.The row reads its container: when the full row would not fit it drops the siblings, then switches
to compact (with showEdges the extra buttons count too), so it never overflows at 320 px. Middle pages land on the calm spring whatever the
temperament; the temperament only decides how much the ball squashes on the first and last page
(none at calm). Pass getPageHref (and linkComponent, for example Next.js Link) to render
crawlable links instead of buttons. loading keeps the ball on the requested page and holds the
range text until the data arrives.
Prop
Type
Also accepts all props of Omit<ComponentProps<"nav">, "children">.
The compact preset in an activity panel: the number rolls inside the ball as you step through.
Click meTap me
pagination, lively
The table preset under an invoices table, with a page-size select. Changing the size resets the
page to 1.
Click meTap me
| Invoice | Amount |
|---|---|
| Invoice #1141 | €907.00 |
| Invoice #1142 | €944.00 |
| Invoice #1143 | €981.00 |
| Invoice #1144 | €118.00 |
pagination, lively
loading keeps the ball on the requested page and holds the range text until the data arrives;
disabled dims every control and keeps the ball on the current page at half opacity.
Click meTap me
pagination, lively
nav labelled "Pagination" (pass aria-label when a page has more than one). Each page is a
button (or link) named "Page 7"; the current one has aria-current="page" and a heavier weight,
so it is never conveyed by colour alone.aria-hidden; ellipses read "More pages". After a change a
polite live region announces "Page 8 of 42" (or "Rows 141 to 160 of 812" in table), not on
every focus move.primary-foreground on primary; page numbers are muted-foreground, both AA in the
two themes. The page-size select uses the field rim of the form components.The number row is one tab stop (roving tabIndex on the current page). Arrow keys move the focus
without changing page, so a server-paged table does not fetch on every keypress.
| Key | Action |
|---|---|
| Tab / Shift + Tab | Previous, the number row (on the current page), next, page-size select |
| ArrowRight / ArrowLeft | Focuses the next or previous page; the ball charges toward it |
| Home / End | Focuses the first or last page button |
| Enter / Space | Goes to the focused page, or runs the focused arrow |
| PageDown / PageUp | Goes to the next or previous page directly |
The ball still glides to the new page, in the short fade time, with no charge stretch and no wall squash: following a moving circle is easier than finding one that jumped. The number crossfades instead of rolling, and the slots swap their numbers in the same fade. Hover tiles, the focus ring and the disabled arrows are unchanged.
The component is 8.8 kB gzip (motion, the ball, roll and beats helpers are shared). Nothing runs at rest. A page change animates one transform on the ball (position and scale on
nested layers), and one short roll or crossfade per slot whose number changed.
The row is measured once per change and on resize (one ResizeObserver for the container, one for
the row). No loops, no lazy parts; the page-size control is a native select.
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, motion.
click, press, a value change
The ball still glides to the new page in the short fade time with no stretch or wall squash, the digits crossfade instead of rolling and the window of pages reflows in the same fade.
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)