Contains a component for a pagination bar and dispatches for page changes
yarn add @workday/canvas-kit-labs-react-pagination
import * as React from 'react';
import Pagination from '@workday/canvas-kit-labs-react-pagination';
const [currentPage, setCurrentPage] = React.useState(1);
return (
<Pagination
total={100}
pageSize={10}
currentPage={currentPage}
onPageChange={p => setCurrentPage(p)}
showLabel
showGoTo
dataLabel="candidate"
/>
);
None
The total number of items.
The number of items to display per page.
The current page being displayed.
Dispatch which is invoked when the page is changed.
Shows a label below the pagination bar describing the items currently being viewed.
Shows a box adjacent to the pagination bar where a page can be entered and is submitted when 'Enter' key is pressed.
Determines the label next to the Go To box. Defaults to 'Go To'. Only usable while showGoTo is set to true.
A function to build a custom label below the pagination bar.
Customizes the aria label for the Pagination container div. Default is 'Pagination'.
Customizes the aria label for the Previous Page Arrow. Default is 'Previous Page'.
Customizes the aria label for the Next Page Arrow. Default is 'Next Page'.
Customizes each page button. Default is (page: number, selected: boolean) =>
${selected ? 'Selected, ' : ''}Page ${page}