Pagination
Moves through a long list one page at a time.
Installation
npm i @uisatin/uiimport { Pagination } from '@uisatin/ui/pagination'About 18.2 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/pagination.jsonAdds pagination.tsx, button.tsx, labels.tsx, pixel-motion.tsx, sliding-indicator.tsx and spinner.tsx to components/ui and installs iconoir-react.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The Pagination component renders a nav named "Pagination" around a list of pages. The current page has aria-current="page"; Previous and Next are disabled at the ends. With getHref the pages are links, otherwise buttons.
| Prop | Type | Default |
|---|---|---|
pageCount | number | — |
page | number | — |
defaultPage | number | 1 |
onPageChange | (page: number) => void | — |
getHref | (page: number) => string | — |
layout | "full""compact" | "full" |
siblings | number | 1 |
motion | "scroll""slide""none" | "scroll" |
previousLabel | string | "Previous" |
nextLabel | string | "Next" |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<'nav'>Other attributes go to <nav> | — |
Accessibility
A nav named "Pagination" (aria-label overrides it) around a list. Pages are named "Page 3"; the current one has aria-current="page". Previous and Next are disabled at the ends and named when icon-only. The compact "Page 5 of 12" is a polite live region. The ellipsis is hidden. With getHref the pages are links, otherwise buttons.
Something wrong or missing on this page?
Report a problemSuggest an improvement