The Pagination component enables the user to select a specific page from a range of pages.
{{ādemoā: āBasicPagination.jsā}}
{{ādemoā: āPaginationOutlined.jsā}}
{{ādemoā: āPaginationRounded.jsā}}
{{ādemoā: āPaginationSize.jsā}}
You can optionally enable first-page and last-page buttons, or disable the previous-page and next-page buttons.
{{ādemoā: āPaginationButtons.jsā}}
Itās possible to customize the control icons.
{{ādemoā: āCustomIcons.jsā}}
You can specify how many digits to display either side of current page with the siblingCount
prop, and adjacent to the start and end page number with the boundaryCount
prop.
{{ādemoā: āPaginationRanges.jsā}}
{{ādemoā: āPaginationControlled.jsā}}
{{ādemoā: āPaginationLink.jsā}}
usePagination
For advanced customization use cases, a headless usePagination()
hook is exposed.
It accepts almost the same options as the Pagination component minus all the props
related to the rendering of JSX.
The Pagination component is built on this hook.
import usePagination from '@mui/material/usePagination';
{{ādemoā: āUsePagination.jsā}}
The Pagination
component was designed to paginate a list of arbitrary items when infinite loading isnāt used.
Itās preferred in contexts where SEO is important, for instance, a blog.
For the pagination of a large set of tabular data, you should use the TablePagination
component.
{{ādemoā: āTablePaginationDemo.jsā}}
Note that the
Pagination
page prop starts at 1 to match the requirement of including the value in the URL, while theTablePagination
page prop starts at 0 to match the requirement of zero-based JavaScript arrays that come with rendering a lot of tabular data.
You can learn more about this use case in the table section of the documentation.
The root node has a role of ānavigationā and aria-label āpagination navigationā by default. The page items have an aria-label that identifies the purpose of the item (āgo to first pageā, āgo to previous pageā, āgo to page 1ā etc.).
You can override these using the getItemAriaLabel
prop.
The pagination items are in tab order, with a tabindex of ā0ā.