Pagination
Allows users to navigate through a large set of content divided into discrete pages.
Usage
Simple Usage
For simple usage, AutoPagination can be used directly. It is a pre-assembled component that handles common pagination use cases.
Advanced Usage
For user that requires more advanced use cases, the pagination functionality can be assembled manually. The user can use the subcomponents: Pagination, PaginationItem, PaginationContent, PaginationEllipsis, PaginationNext, PaginationPrevious and PaginationNumber.
Examples
AutoPagination Types
Use the type props to change the type of the AutoPagination component. Examples of use cases for each types are outlined below:
- default: Ideal for contexts where users might want to jump to a specific page within a large number of pages.
- simple: Suitable for simpler navigation where users primarily move forward or backward.
- full: Similar to the
simpletype, this type displays the current page and total pages on the left and navigation buttons on far right.
Pagination Configurations
Opting into using AutoPagination or manual assembly of pagination subcomponents necessitates into the usage of props such as page, limit and count. The functionality and look of the pagination components will be influenced by them.
AutoPagination
Manual assembly
Props
AutoPagination
A pagination component that handles page navigation and different display patterns: default, simple, and full. This is a standalone and pre-assembled component that can handle common pagination use cases.
| Prop | Type | Default |
|---|---|---|
count | number | - |
limit | number | - |
page | number | - |
maxDisplay | number | 4 |
type | enum | default |
onPageChange | function | - |
fullText | string | - |
next | ReactNode | - |
previous | ReactNode | - |
Pagination
A container component that provides pagination context and navigation structure through a nav element. It manages the core pagination state (current page, total pages, etc.).
| Prop | Type | Default |
|---|---|---|
count | number | - |
limit | number | - |
page | number | - |
type | enum | default |
onPageChange | function | - |
PaginationContent
A layout component rendered as an unordered list ul that arranges PaginationItem in a horizontal row.
PaginationItem
A wrapper component rendered as a list item li that contains individual pagination elements like PaginationNext, PaginationPrevious, PaginationLabel and PaginationEllipsis.
PaginationNext
A button component that handles navigaton to the next page. The underlying component can be substituted by using the asChild props.
PaginationPrevious
A button component that handles navigaton to the previous page. The underlying component can be substituted by using the asChild props.
PaginationLabel
A text component that displays pagination information.
| Prop | Type | Default |
|---|---|---|
content | string | - |
PaginationEllipsis
A visual indicator component that represents skipped page numbers in the pagination sequence, rendered as three dots using an icon.