@zendeskgarden/react-pagination
v9.4.0
Published
Components relating to pagination in the Garden Design System
Downloads
357,864
Maintainers
Readme
@zendeskgarden/react-pagination
This package includes components relating to pagination in the Garden Design System.
Installation
npm install @zendeskgarden/react-pagination
# Peer Dependencies - Also Required
npm install react react-dom styled-components @zendeskgarden/react-theming
Usage
Offset Pagination
import { ThemeProvider } from '@zendeskgarden/react-theming';
import { Pagination } from '@zendeskgarden/react-pagination';
initialState = {
currentPage: 1
};
/**
* Place a `ThemeProvider` at the root of your React application
*/
<ThemeProvider>
<Pagination
totalPages={11}
currentPage={state.currentPage}
onChange={currentPage => setState({ currentPage })}
/>
</ThemeProvider>;
Cursor Pagination
import { ThemeProvider } from '@zendeskgarden/react-theming';
import { CursorPagination } from '@zendeskgarden/react-pagination';
/**
* Place a `ThemeProvider` at the root of your React application
*/
<ThemeProvider>
<CursorPagination aria-label="Cursor pagination">
<CursorPagination.First>First</CursorPagination.First>
<CursorPagination.Previous>Previous</CursorPagination.Previous>
<CursorPagination.Next>Next</CursorPagination.Next>
<CursorPagination.Last>Last</CursorPagination.Last>
</CursorPagination>
</ThemeProvider>;