跳转到内容

🎉 Material UI v5 is out now! Check out the announcement blog post

Pagination API

The API documentation of the Pagination React component. Learn more about the props and the CSS customization points.

Import

import Pagination from '@material-ui/lab/Pagination';
// or
import { Pagination } from '@material-ui/lab';

You can learn more about the difference by reading this guide.

Component name

The MuiPagination name can be used for providing default props or style overrides at the theme level.

Props

Name Type Default Description
boundaryCount number 1 Number of always visible pages at the beginning and end.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
color 'primary'
| 'secondary'
| 'standard'
'standard' The active color.
count number 1 The total number of pages.
defaultPage number 1 The page selected by default when the component is uncontrolled.
disabled bool false If true, the pagination component will be disabled.
getItemAriaLabel func Accepts a function which returns a string value that provides a user-friendly name for the current page.
For localization purposes, you can use the provided translations.

Signature:
function(type: string, page: number, selected: bool) => string
type: The link or button type to format ('page'
hideNextButton bool false If true, hide the next-page button.
hidePrevButton bool false If true, hide the previous-page button.
onChange func Callback fired when the page is changed.

Signature:
function(event: object, page: number) => void
event: The event source of the callback.
page: The page selected.
page number The current page.
renderItem func (item) => <PaginationItem {...item} /> Render the item.

Signature:
function(params: PaginationRenderItemParams) => ReactNode
params: The props to spread on a PaginationItem.
shape 'round'
| 'rounded'
'round' The shape of the pagination items.
showFirstButton bool false If true, show the first-page button.
showLastButton bool false If true, show the last-page button.
siblingCount number 1 Number of always visible pages before and after the current page.
size 'large'
| 'medium'
| 'small'
'medium' The size of the pagination component.
variant 'outlined'
| 'text'
'text' The variant to use.

The ref is forwarded to the root element.

Any other props supplied will be provided to the root element (native element).

CSS

Rule name Global class Description
root .MuiPagination-root Styles applied to the root element.
ul .MuiPagination-ul Styles applied to the ul element.

You can override the style of the component thanks to one of these customization points:

If that's not sufficient, you can check the implementation of the component for more detail.

Demos