@carbon/react
Version:
React components for the Carbon Design System
103 lines (102 loc) • 2.94 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2023
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
type ExcludedAttributes = 'id' | 'onChange';
export interface PaginationPageSize {
text: string;
value: number;
}
export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLDivElement>, ExcludedAttributes> {
/**
* The description for the backward icon.
*/
backwardText?: string;
/**
* The CSS class names.
*/
className?: string;
/**
* `true` if the backward/forward buttons, as well as the page select elements, should be disabled.
*/
disabled?: boolean;
/**
* The description for the forward icon.
*/
forwardText?: string;
/**
* The unique ID of this component instance.
*/
id?: string | number;
/**
* `true` if the current page should be the last page.
*/
isLastPage?: boolean;
/**
* The function returning a translatable text showing where the current page is,
* in a manner of the range of items.
*/
itemRangeText?: (min: number, max: number, total: number) => string;
/**
* A variant of `itemRangeText`, used if the total number of items is unknown.
*/
itemText?: (min: number, max: number) => string;
/**
* The translatable text indicating the number of items per page.
*/
itemsPerPageText?: string;
/**
* The callback function called when the current page changes.
*/
onChange?: (data: {
page: number;
pageSize: number;
ref?: React.RefObject<any>;
}) => void;
/**
* The current page.
*/
page?: number;
/**
* `true` if the select box to change the page should be disabled.
*/
pageInputDisabled?: boolean;
pageNumberText?: string;
/**
* A function returning PII showing where the current page is.
*/
pageRangeText?: (current: number, total: number) => string;
/**
* The number dictating how many items a page contains.
*/
pageSize?: number;
/**
* `true` if the select box to change the items per page should be disabled.
*/
pageSizeInputDisabled?: boolean;
/**
* The choices for `pageSize`.
*/
pageSizes: number[] | PaginationPageSize[];
/**
* The translatable text showing the current page.
*/
pageText?: (page: number, pagesUnknown?: boolean) => string;
/**
* `true` if the total number of items is unknown.
*/
pagesUnknown?: boolean;
/**
* Specify the size of the Pagination.
*/
size?: 'sm' | 'md' | 'lg';
/**
* The total number of items.
*/
totalItems?: number;
}
declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLDivElement>>;
export default Pagination;