Pagination
Display active page and navigate between multiple pages
Import
Source
Docs
Package
Usage
Color
Shades
Size
xs
sm
md
lg
xl
Radius
xs
sm
md
lg
xl
Controlled
To control component state provide value
and onChange
props:
Siblings
Control number of active item siblings with siblings
prop:
1 sibling (default)
2 siblings
3 siblings
Boundaries
Control number of items displayed after previous and before next buttons with boundaries
prop:
1 boundary (default)
2 boundaries
3 boundaries
Styles API
You can use data-active
attribute on control
selector to change styles of selected item:
Compound components
You can use the following compound components to have full control over the Modal
rendering:
Pagination.Root
– context providerPagination.Items
– items listPagination.Next
– next controlPagination.Previous
– previous controlPagination.First
– first controlPagination.Last
– last control
Controls as links
Change icons
use-pagination hook
If you need more flexibility @asuikit/hooks exports use-pagination hook, you can use it to create your own pagination component.
Pagination component props
Name | Type | Description |
---|---|---|
align | AlignItems | Defines align-items css property |
boundaries | number | Number of elements visible on the left/right edges, 1 by default |
color | MantineColor | Key of theme.colors, active item color, theme.primaryColor by default |
defaultValue | number | Active page for uncontrolled component, must be an integer in [0, total] interval |
disabled | boolean | Determines whether all controls should be disabled, false by default |
dotsIcon | PaginationIcon | Dots icon component |
firstIcon | PaginationIcon | First control icon component |
getControlProps | (control: "first" | "last" | "next" | "previous") => Record<string, any> | Adds props to next/previous/first/last controls |
getItemProps | (page: number) => Record<string, any> | Add additional props to items |
grow | boolean | Defines flex-grow property for each element, true -> 1, false -> 0 |
lastIcon | PaginationIcon | Last control icon component |
nextIcon | PaginationIcon | Next control icon component |
noWrap | boolean | Defined flex-wrap property |
onChange | (value: number) => void | Called when page changes |
onFirstPage | () => void | Called when first page control is clicked |
onLastPage | () => void | Called when last page control is clicked |
onNextPage | () => void | Called when next page control is clicked |
onPreviousPage | () => void | Called when previous page control is clicked |
position | "left" | "right" | "center" | "apart" | Defines justify-content property |
previousIcon | PaginationIcon | Previous control icon component |
radius | number | "xs" | "sm" | "md" | "lg" | "xl" | Key of theme.radius, border-radius of items and controls, theme.defaultRadius by default |
siblings | number | Number of siblings displayed on the left/right side of selected page, 1 by default |
size | number | "xs" | "sm" | "md" | "lg" | "xl" | Controls height and min-width |
spacing | number | "xs" | "sm" | "md" | "lg" | "xl" | Space between elements |
total * | number | Total number of pages, must be an integer |
value | number | Active page for controlled component, must be an integer in [0, total] interval |
withControls | boolean | Determines whether next/previous controls should be rendered, true by default |
withEdges | boolean | Determines whether first/last controls should be rendered, false by default |
Pagination.Root component props
Name | Type | Description |
---|---|---|
boundaries | number | Number of elements visible on the left/right edges, 1 by default |
children | ReactNode | Pagination content |
color | MantineColor | Key of theme.colors, active item color, theme.primaryColor by default |
defaultValue | number | Active page for uncontrolled component, must be an integer in [0, total] interval |
disabled | boolean | Determines whether all controls should be disabled, false by default |
getItemProps | (page: number) => Record<string, any> | Add additional props to items |
onChange | (value: number) => void | Called when page changes |
onFirstPage | () => void | Called when first page control is clicked |
onLastPage | () => void | Called when last page control is clicked |
onNextPage | () => void | Called when next page control is clicked |
onPreviousPage | () => void | Called when previous page control is clicked |
radius | number | "xs" | "sm" | "md" | "lg" | "xl" | Key of theme.radius, border-radius of items and controls, theme.defaultRadius by default |
siblings | number | Number of siblings displayed on the left/right side of selected page, 1 by default |
size | number | "xs" | "sm" | "md" | "lg" | "xl" | Controls height and min-width |
total * | number | Total number of pages, must be an integer |
value | number | Active page for controlled component, must be an integer in [0, total] interval |
Pagination.Items component props
Name | Type | Description |
---|---|---|
dotsIcon | PaginationIcon | Dots icon component |
Pagination component Styles API
Name | Static selector | Description |
---|---|---|
control | .asuikit-Pagination-control | Control element: items, next/previous, first/last buttons |
dots | .asuikit-Pagination-dots | Dots icon wrapper |