Pagination
Navigation
Data Display
Navigation components for paginated content. Includes simple prev/next controls and full pagination with page numbers.
Simple Pagination
Basic previous/next navigation
Page 1 of 10
Full Pagination
Complete pagination with page numbers and ellipsis
Page 5 of 20
With Results Info
Show current range and total results
Showing 21-30 of 150 results
Primitive Components
Build custom pagination layouts with primitives
Usage
How to implement Pagination
import {
SimplePagination,
FullPagination,
// Or primitives for custom layouts:
Pagination,
PaginationContent,
PaginationItem,
PaginationLink,
PaginationPrevious,
PaginationNext,
PaginationEllipsis,
} from '@/components/ui/pagination'
// Simple prev/next pagination
const [page, setPage] = useState(1)
<SimplePagination
currentPage={page}
totalPages={10}
onPageChange={setPage}
/>
// Full pagination with page numbers
<FullPagination
currentPage={page}
totalPages={20}
onPageChange={setPage}
siblingCount={1}
/>
// With results info
<FullPagination
currentPage={page}
totalPages={15}
onPageChange={setPage}
showResults
totalResults={150}
resultsPerPage={10}
/>
// Custom layout with primitives
<Pagination>
<PaginationContent>
<PaginationItem>
<PaginationPrevious onClick={() => setPage(p => p - 1)} />
</PaginationItem>
{pages.map(p => (
<PaginationItem key={p}>
<PaginationLink
isActive={p === page}
onClick={() => setPage(p)}
>
{p}
</PaginationLink>
</PaginationItem>
))}
<PaginationItem>
<PaginationNext onClick={() => setPage(p => p + 1)} />
</PaginationItem>
</PaginationContent>
</Pagination>Component Props
API reference for Pagination components
| Prop | Type | Default | Description |
|---|---|---|---|
SimplePagination | component | — | Basic prev/next pagination |
currentPage* | number | — | Current active page (1-indexed) |
totalPages* | number | — | Total number of pages |
onPageChange* | (page: number) => void | — | Callback when page changes |
FullPagination | component | — | Full pagination with numbers |
siblingCount | number | 1 | Pages shown on each side of current |
showResults | boolean | false | Show results count |
totalResults | number | — | Total number of results |
resultsPerPage | number | 10 | Results per page |
PaginationLink | component | — | Individual page button |
isActive | boolean | — | Whether link is current page |
disabled | boolean | — | Disable the link |
size | "sm" | "default" | "icon" | "icon" | Button size |
Features
Pagination component capabilities
- Smart ellipsis: Automatically shows ellipsis for large page counts
- Sibling control: Configure how many pages show around current
- Results display: Show "Showing X-Y of Z results"
- Disabled states: Prev disabled on first page, Next on last
- Composable: Use primitives for custom layouts
- Keyboard accessible: Full keyboard navigation support
- Dark mode: Automatic dark mode styling