Overview
The Pagination component provides a flexible way to navigate through pages of content, with support for sibling page display, edge buttons, and different sizes.Import
Basic Usage
Uncontrolled
With Edge Buttons
Sibling Pages
Control how many page numbers appear on each side of the current page:Sizes
Disabled State
Complete Example
Props
PaginationProps
| Prop | Type | Default | Description |
|---|---|---|---|
total | number | required | Total number of pages |
value | number | undefined | Current page (1-based, controlled) |
defaultValue | number | 1 | Default page for uncontrolled mode |
onChange | (page: number) => void | undefined | Called when page changes |
siblings | number | 1 | Number of sibling pages visible on each side |
withEdges | boolean | false | Whether to show first/last page buttons |
disabled | boolean | false | Disable all interactions |
size | 'sm' | 'md' | 'lg' | 'md' | Button size variant |
className | string | '' | Additional CSS classes |
Size Dimensions
| Size | Button Size | Font Size |
|---|---|---|
sm | 28px × 28px | 12px |
md | 32px × 32px | 14px |
lg | 40px × 40px | 16px |
Page Range Algorithm
The component intelligently shows page numbers based on the current page:- Always shows first and last page
- Shows
siblingsnumber of pages on each side of current page - Inserts ellipsis (
…) when there’s a gap - Condenses to direct page numbers when total pages is small
Example with siblings=:
- Page 1 of 10:
[1] 2 … 10 - Page 5 of 10:
1 … 4 [5] 6 … 10 - Page 10 of 10:
1 … 9 [10]
Navigation Buttons
- ‹ Previous page
- › Next page
- « First page (when
withEdges={true}) - » Last page (when
withEdges={true})
Accessibility
- Wrapped in semantic
<nav>witharia-label="Pagination" - Current page button has
aria-current="page" - Previous/Next buttons have descriptive
aria-labelattributes - Edge buttons have “First page” and “Last page” labels
- Disabled states prevent interaction
- Focus visible ring for keyboard navigation
- All buttons are properly labeled for screen readers
Controlled vs Uncontrolled
Controlled: Usevalue and onChange props when you need to manage page state externally.
defaultValue when the component manages its own state.