@zendeskgarden/react-pagination
TypeScript icon, indicating that this package has built-in type declarations

8.76.1 • Public • Published

@zendeskgarden/react-pagination npm version

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>;

Package Sidebar

Install

npm i @zendeskgarden/react-pagination

Weekly Downloads

3,312

Version

8.76.1

License

Apache-2.0

Unpacked Size

80.4 kB

Total Files

48

Last publish

Collaborators

  • zendesk-garden