Pagination
Pagination helps users navigate through multiple pages of content.
Installation
Usage
Props
Pagination
Extends View
props.
Prop | Type | Default | Description |
---|---|---|---|
currentPage | number | - | The current active page number. |
totalPages | number | - | The total number of pages. |
totalItems | number | - | The total number of items across all pages. |
onPageChange | (page: number) => void | - | Callback fired when the page changes. |
className | string | - | Additional Tailwind classes to apply. |
Examples
Basic Usage
With State Management
Styling
The Pagination component uses Tailwind CSS classes for styling. Default styling includes:
- Container width: 393px
- Button dimensions: 50px × 50px
- Rounded corners
- Primary color for active buttons
- Gray color for disabled state
- Consistent padding and spacing
- Center-aligned text
States
The pagination buttons have several states:
- Active: Primary background color
- Disabled: Gray background color (when at first/last page)
- Default: Primary background color
Accessibility
The Pagination component:
- Uses
accessibilityRole="button"
for navigation buttons - Provides
accessibilityLabel
for screen readers - Includes proper
accessibilityState
for disabled buttons - Maintains WCAG color contrast requirements
- Supports keyboard navigation
- Uses adequate touch target sizes (50x50px)