UNPKG

3.22 kBTypeScriptView Raw
1import * as React from 'react';
2import { OverridableStringUnion } from '@mui/types';
3import { SxProps } from '@mui/system';
4import { InternalStandardProps as StandardProps } from '@mui/material';
5import { Theme } from '../styles';
6import { UsePaginationItem, UsePaginationProps } from '../usePagination/usePagination';
7import { PaginationClasses } from './paginationClasses';
8
9export interface PaginationRenderItemParams extends UsePaginationItem {
10 color: PaginationProps['color'];
11 shape: PaginationProps['shape'];
12 size: PaginationProps['size'];
13 variant: PaginationProps['variant'];
14}
15
16export interface PaginationPropsVariantOverrides {}
17
18export interface PaginationPropsSizeOverrides {}
19
20export interface PaginationPropsColorOverrides {}
21
22export interface PaginationProps
23 extends UsePaginationProps,
24 StandardProps<React.HTMLAttributes<HTMLElement>, 'children' | 'onChange'> {
25 /**
26 * Override or extend the styles applied to the component.
27 */
28 classes?: Partial<PaginationClasses>;
29 /**
30 * The active color.
31 * It supports both default and custom theme colors, which can be added as shown in the
32 * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
33 * @default 'standard'
34 */
35 color?: OverridableStringUnion<
36 'primary' | 'secondary' | 'standard',
37 PaginationPropsColorOverrides
38 >;
39 /**
40 * Accepts a function which returns a string value that provides a user-friendly name for the current page.
41 * This is important for screen reader users.
42 *
43 * For localization purposes, you can use the provided [translations](https://mui.com/material-ui/guides/localization/).
44 * @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
45 * @param {number | null} page The page number to format.
46 * @param {boolean} selected If true, the current page is selected.
47 * @returns {string}
48 */
49 getItemAriaLabel?: (
50 type: UsePaginationItem['type'],
51 page: UsePaginationItem['page'],
52 selected: UsePaginationItem['selected'],
53 ) => string;
54
55 /**
56 * Render the item.
57 * @param {PaginationRenderItemParams} params The props to spread on a PaginationItem.
58 * @returns {ReactNode}
59 * @default (item) => <PaginationItem {...item} />
60 */
61 renderItem?: (params: PaginationRenderItemParams) => React.ReactNode;
62 /**
63 * The shape of the pagination items.
64 * @default 'circular'
65 */
66 shape?: 'circular' | 'rounded';
67 /**
68 * The size of the component.
69 * @default 'medium'
70 */
71 size?: OverridableStringUnion<'small' | 'medium' | 'large', PaginationPropsSizeOverrides>;
72 /**
73 * The system prop that allows defining system overrides as well as additional CSS styles.
74 */
75 sx?: SxProps<Theme>;
76 /**
77 * The variant to use.
78 * @default 'text'
79 */
80 variant?: OverridableStringUnion<'text' | 'outlined', PaginationPropsVariantOverrides>;
81}
82
83/**
84 *
85 * Demos:
86 *
87 * - [Pagination](https://mui.com/material-ui/react-pagination/)
88 *
89 * API:
90 *
91 * - [Pagination API](https://mui.com/material-ui/api/pagination/)
92 */
93export default function Pagination(props: PaginationProps): React.JSX.Element;