Page 6 of 20
Playground
Change the props and copy the code. The controls come from the component's TypeScript types.
Props
total20
siblings1
import { Pagination } from "@/components/ui/pagination";<Pagination total={20} />Installation
$ pnpm dlx shadcn@latest add @synccn/paginationFirst time in this project? Connect synccn with one command.
Usage
import { Pagination } from "@/components/ui/pagination";<Pagination total={20} />API reference
Generated from the component's TypeScript types, so it always matches the code.
PropTypeDescription
- totalrequired
numberNumber of pages.
- page
numberControlled current page (1-based).
- defaultPage
numberDefault
1Initial page when uncontrolled.
- onPageChange
(page: number) => voidCalled with the new page.
- siblings
numberDefault
1Pages shown either side of the current one.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for ChevronLeft, ChevronRight, MoreHorizontal
Used by
Accessibility
- The current page is marked with aria-current="page".
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-current, aria-label
- Shows a visible focus ring for keyboard users
More navigation
BreadcrumbPath to the current page, with chevrons or slashes.StepperProgress through a multi-step flow.DockApp dock that magnifies icons near the pointer.Navigation MenuSite navigation with mega-menu panels.SidebarCollapsible app sidebar with groups, badges and nested items.Scroll ProgressReading progress bar for the page or any scroll container.