Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
  • Forms & inputs
  • Layout & containers
    • Anchors
    • Box
    • Col
    • Container
    • ContainerNext
    • FullPageLayout
    • Grid
    • HStack
    • Header
    • Header
    • LayoutGrid
    • Navigation
    • Pagination
    • Row
    • Section
    • Spacer
    • TabList
    • TabList
    • Tabs
    • VStack
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Layout & containers
  • Pagination

Pagination

Moves between pages of a list and shows which one is open. Set `hasUnknownPageCount` for cursor APIs that never report a total.

Health
Component health
Source
View on Github
Storybook
View in Storybook
Playground
No Example
Accessibility

not-compliant

Platform
Universal
Accessibility issues
There is no href attributes on links. The links are used as buttons.
  • Overview
  • Props

Basic usage​

1
2
3
4
5
6
...

Unknown page count​

Some backends paginate with an opaque cursor and report only whether a next page exists — never a total. Set hasUnknownPageCount to page through those lists: pageCount becomes a lower bound rather than the real total, and a non-interactive … marks that more pages may follow.

1
2

...

pageCount still has to cover every page the user can reach — the last page is always pageCount - 1. So while more pages exist, pass the pages you have loaded plus one for the next page the backend says exists:

<Pagination
page={page}
pageCount={loadedPages.length + (hasNextPage ? 1 : 0)}
hasUnknownPageCount={hasNextPage}
onChange={handleChange}
/>

Numbers then appear as the user walks forward — [1] 2 … becomes 1 [2] 3 …, and reaching the last page drops both the … and the next button, since the total is finally known.

Every numbered page must be reachable in one step

With a forward-only cursor you can only fetch the page after the last one you loaded. Keep pageCount at one past your loaded pages so no button points further ahead than a single request — otherwise clicking a number would need to walk several cursors. The trailing … is deliberately not pressable for the same reason: there is no known last page to jump to.

Grow pageCount as pages load. It caps navigation, so a pageCount that never grows leaves the user stuck on pageCount - 1.


Alignment​

If you want to change the alignment of the pagination component, you can wrap the pagination component into an HStack component and set the sx property "alignSelf".

Align the pagination component to the right:

<HStack
sx={{
alignSelf: "flex-end",
}}
>
<Pagination page={page} pageCount={pageCount} />
</HStack>

Align the pagination component to the center:

<HStack
sx={{
alignSelf: "center",
}}
>
<Pagination page={page} pageCount={pageCount} />
</HStack>
tip
This component is universal, its usage is the same in murray and murray/mobile.

Pagination props

NameTypeDefault ValueDescriptionUsage count
debounceTimernumberundefined
hasUnknownPageCountbooleanundefinedfalseSet when the total is unknown: `pageCount` is only a lower bound and more pages exist beyond it. Renders a non-interactive trailing `...` to say so. For cursor/keyset-paginated lists, where the backend reports "there is a next page" but no total. `pageCount` must still include every reachable page — so while more pages exist, count the loaded ones plus the next one the backend promised. The last page is always `pageCount - 1`.
maxPageItemsnumberundefined7
onChange*(page: number) => void
page*number
pageCount*number
Edit this page
Previous
Navigation
Next
Row
  • Basic usage
  • Unknown page count
  • Alignment