Pagination

The Pagination component enables the user to select a specific page from a range of pages.

<Pagination totalRecord={1000} onChange={console.log} itemsPerPage={20} />

Props

PropTypeDefaultDescription
totalRecordnumber1The total number of records.
rowsPerPagebooleanfalseIf the value is true then rows per page will be displayed.
onChangeFuncCallback fired when the page is changed.
onItemsPerPageChangeFuncCallback fired when the rowsPerPage is changed.
pagenumber1The current page.
menuPropsobjectProps applied to the Menu dropdown
itemsPerPageOptionsArray<number>The values provided in the array will be displayed as options to select pagination rows per page.
itemsPerPagenumber1This value is used to calculate to display number of records per page.

Examples

RowsPerPage

() => {
const [itemsPerPage, setItemsPerPage] = React.useState(20);
const onChange = (value) => {
console.log(value)
setItemsPerPage(value)
}
return (
<Pagination
rowsPerPage
menuProps={{value: 'rows per page'}}
totalRecord={100}
itemsPerPageOptions={[20, 30, 40]}
itemsPerPage={itemsPerPage}
onChange={console.log}
onItemsPerPageChange={onChange}
/>
);
};