跳转到内容

Pagination API

API documentation for the React Pagination component. Learn about the available props, and the CSS API.

Import

import Pagination from '@mui/material/Pagination';
// 或
import { Pagination } from '@mui/material';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiPagination can be used when providing default props or style overrides in the theme.

属性

Props of the 原生(Native) component are also available.

名称类型默认值描述
boundaryCountinteger1
Number of always visible pages at the beginning and end.
classesobject
Override or extend the styles applied to the component. See CSS API below for more details.
color'primary'
| 'secondary'
| 'standard'
| string
'standard'
The active color.
countinteger1
The total number of pages.
defaultPageinteger1
The page selected by default when the component is uncontrolled.
disabledboolfalse
如果被设置为 true,那么该组件将会被禁用。
getItemAriaLabelfunc
Accepts a function which returns a string value that provides a user-friendly name for the current page. This is important for screen reader users.
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' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
page: The page number to format.
selected: If true, the current page is selected.
hideNextButtonboolfalse
If true, hide the next-page button.
hidePrevButtonboolfalse
If true, hide the previous-page button.
onChangefunc
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.
pageinteger
The current page.
renderItemfunc(item) => <PaginationItem {...item} />
Render the item.

Signature:
function(params: PaginationRenderItemParams) => ReactNode
params: The props to spread on a PaginationItem.
shape'circular'
| 'rounded'
'circular'
The shape of the pagination items.
showFirstButtonboolfalse
If true, show the first-page button.
showLastButtonboolfalse
If true, show the last-page button.
siblingCountinteger1
Number of always visible pages before and after the current page.
size'small'
| 'medium'
| 'large'
| string
'medium'
The size of the autocomplete.
sxfunc
| object
The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.
variant'outlined'
| 'text'
| string
'text'
The variant to use.

ref 则会被传递到根元素中。

CSS

Rule nameGlobal class描述
root.MuiPagination-rootStyles applied to the root element.
ul.MuiPagination-ulStyles applied to the ul element.
outlined.MuiPagination-outlinedStyles applied to the root element if variant="outlined".
text.MuiPagination-textStyles applied to the root element if variant="text".

You can override the style of the component using one of these customization options:

Demos