Showing 1-10 of 100
<Pagination
  page={page}
  setPage={setPage}
  perPage={10}
  totalCount={100}
/>

Installation

Barrel

import { Pagination } from "@cloudflare/kumo";

Granular

import { Pagination } from "@cloudflare/kumo/components/pagination";

Usage

import { useState } from "react";
import { Pagination } from "@cloudflare/kumo";

export default function Example() {
  const [page, setPage] = useState(1);

  return (
    <Pagination
      page={page}
      setPage={setPage}
      perPage={10}
      totalCount={100}
    />
  );
}

Examples

Full Controls (Default)

The default pagination includes first, previous, page input, next, and last buttons.

Showing 1-10 of 100
<Pagination
  page={page}
  setPage={setPage}
  perPage={10}
  totalCount={100}
  controls="full"
/>

Simple Controls

Use controls="simple" for a minimal pagination with only previous and next buttons.

Showing 1-10 of 100
<Pagination
  page={page}
  setPage={setPage}
  perPage={10}
  totalCount={100}
  controls="simple"
/>

Mid-Page State

Pagination in the middle of a dataset with all navigation enabled.

Showing 41-50 of 100
<Pagination
  page={5}
  setPage={setPage}
  perPage={10}
  totalCount={100}
/>

Large Dataset

Pagination handles large datasets with many pages.

Showing 1-25 of 1250
<Pagination
  page={1}
  setPage={setPage}
  perPage={25}
  totalCount={1250}
/>

Custom Text

You can set custom pagination text

Page 1 - showing 25 per page
<Pagination
  text={({perPage}) => `Showing ${perPage} per page!`}
  page={1}
  setPage={setPage}
  perPage={25}
  totalCount={100}
/>

API Reference

PropTypeDefaultDescription
controls"full" | "simple""full"-
setPage*(page: number) => void-Callback when page changes
pagenumber-Current page number (1-indexed).
perPagenumber-Number of items displayed per page.
totalCountnumber-Total number of items across all pages.
textobject-Method to provide custom pagination text