Pagination
The Pagination component enables the user to select a specific page from a range of pages.
Basic Pagination
Preview
Usage
import { Pagination } from 'archi-ui'
<Pagination totalPages={10} />
Disabled
Use disabled
prop to make the pagination disabled.
Preview
Variant
The Pagination
comes with two variants: ghost(default), outlined.
Preview
Shape
Use shape
prop to give different shape to the pagination item.
Preview
Size
The Pagination
comes with three variants: outlined(default), filled, standard.
Preview
Customization
You can optionally enable first-page and last-page buttons using showFirstButton
and showLastButton
props, and can also customize the control icons using firstButtonIcon
and lastButtonIcon
props
Preview
Custome icons
It’s possible to customize the control icons using previousIcon
, nextIcon
props
Preview
Pagination ranges
You can specify how many digits to display either side of the current page with the siblingCount
prop, and adjacent to the start and end page number with the boundaryCount
prop.
Preview
Controlled
If the page
is set using useState, to update to next page or previous page on click, use onPageChange()
to update the state of page
.
Preview
Pagination API
API reference docs for the React Pagination component.
Props
Name | Type | Default | Description |
---|---|---|---|
className | string | - | Override or extend the styles applied to the component |
variant | 'ghost' | 'outlined' | 'ghost' | The variant to use. |
size | 'sm' | 'md' | 'lg' | 'md' | The size of the component. |
color | 'default' | 'primary' | 'secondary' | 'info' | 'warning' | 'success' | 'error' | 'default' | The active color. |
shape | 'pill' | 'rounded' | 'square' | 'rounded' | The shape of the pagination items. |
disabled | bool | false | If true , the component is disabled. |
totalPages | integer | 1 | The total number of pages. |
defaultPage | integer | 1 | The page selected by default when the component is uncontrolled. |
page | integer | - | The current page of pagination. |
previousIcon | node | <ArrowSmLeftIcon /> | Override the default previous icon element. |
nextIcon | node | <ArrowSmRightIcon /> | Override the default next icon element. |
showFirstButton | bool | false | If true, show the first-page button. |
showLastButton | bool | false | If true, show the last-page button. |
firstButtonIcon | node | <ArrowNarrowLeftIcon /> | Override the default first-page icon element. Shown only if showFirstButton is set. |
lastButtonIcon | node | <ArrowNarrowRightIcon /> | Override the default last-page icon element. Shown only if showLastButton is set. |
siblingCount | integer | 1 | Number of always visible pages before and after the current page. |
boundaryCount | integer | 1 | Number of always visible pages at the beginning and end. |
onPageChange | func | - | Callback fired when the page is changed. Signature: function(page: number) => void . page : The page selected. |