Pagination
Sliding Pagination
Pagination whose active pill slides between page numbers with a spring bounce.
npx motionsnack add sliding-paginationCustomize
<SlidingPagination />Props
14 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | number | - | Controlled current page, 1-based. |
| onChange | (page: number) => void | - | Called with the new page whenever the user picks one. |
| getHref | (page: number) => string | - | Link mode: every page renders as a link to this address. Without it the pages are buttons. |
| linkComponent | ElementType | 'a' | Renders the links in link mode, e.g. the app's router link. |
| resultsId | string | - | Id of the results heading or container (tabIndex={-1}) that gets focus after a page change. |
| labels | { previous?, next?, page?, pageOf? } | English | UI strings; {page} and {total} are replaced. |
| className | string | '' | Extra classes on the nav element. |
| total | number | 10 | Number of pages. |
| defaultValue | number | 1 | Page selected on first render when uncontrolled. |
| siblings | number | 1 | Page numbers shown on each side of the current page. |
| boundaries | number | 1 | Page numbers always shown at the start and at the end. |
| showArrows | boolean | true | Previous and next buttons at the ends. |
| size | 'sm' | 'md' | 'md' | Button size: 36 in a table footer or toolbar, 44 standalone. |
| label | string | 'Pagination' | Accessible name of the navigation landmark. |
About Sliding Pagination
Page numbers with previous and next buttons, where the filled pill behind the current page is one shared element. Picking another page makes the pill slide across the row and settle with a spring bounce, while the numbers change colour underneath it. Long ranges collapse into ellipses, and the row keeps the same number of slots on every page so it never changes width. It works controlled through page and onPageChange or uncontrolled through defaultPage. Size, gap, radius, bounce and duration are all props. With reduced motion the pill jumps straight to the new page.
What's included
- Shared layout pill with a spring bounce
- Ellipsis for long ranges, constant row width
- Previous and next buttons with disabled ends
- Controlled and uncontrolled page state
- Siblings and boundaries settings
- aria-current and labelled page buttons
- Light and dark, reduced motion respected
- Type
- Animated React pagination component
- Library
- Components · Pagination
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-09-20
- Install
npx motionsnack add sliding-pagination