Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
React Data Table already has a "Material" looking Pagination, but if you want to go a step further you can integration Material UI's Pagination component.
Using the paginationComponent
property is you can access React Data Tables internal pagination properties.
({ rowsPerPage, rowCount, onChangePage, onChangeRowsPerPage, currentPage }) => ...
import React from 'react'; import TablePagination from '@material-ui/core/TablePagination'; import IconButton from '@material-ui/core/IconButton'; import FirstPageIcon from '@material-ui/icons/FirstPage'; import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft'; import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight'; import LastPageIcon from '@material-ui/icons/LastPage'; function TablePaginationActions({ count, page, rowsPerPage, onChangePage }) { const handleFirstPageButtonClick = () => { onChangePage(1); }; // RDT uses page index starting at 1, MUI starts at 0 // i.e. page prop will be off by one here const handleBackButtonClick = () => { onChangePage(page); }; const handleNextButtonClick = () => { onChangePage(page + 2); }; const handleLastPageButtonClick = () => { onChangePage(getNumberOfPages(count, rowsPerPage)); }; return ( <> <IconButton onClick={handleFirstPageButtonClick} disabled={page === 0} aria-label="first page"> <FirstPageIcon /> </IconButton> <IconButton onClick={handleBackButtonClick} disabled={page === 0} aria-label="previous page"> <KeyboardArrowLeft /> </IconButton> <IconButton onClick={handleNextButtonClick} disabled={page >= getNumberOfPages(count, rowsPerPage) - 1} aria-label="next page" > <KeyboardArrowRight /> </IconButton> <IconButton onClick={handleLastPageButtonClick} disabled={page >= getNumberOfPages(count, rowsPerPage) - 1} aria-label="last page" > <LastPageIcon /> </IconButton> </> ); } const CustomMaterialPagination = ({ rowsPerPage, rowCount, onChangePage, onChangeRowsPerPage, currentPage }) => ( <TablePagination component="nav" count={rowCount} rowsPerPage={rowsPerPage} page={currentPage - 1} onChangePage={onChangePage} onChangeRowsPerPage={({ target }) => onChangeRowsPerPage(Number(target.value))} ActionsComponent={TablePaginationActions} /> ); export default CustomMaterialPagination'
You can now pass CustomMaterialPagination
to paginationComponent
... <DataTable columns={columns} data={data} pagination paginationComponent={CustomMaterialPagination} /> ...