# @vtaits/react-paginator

> Simple customizable pagination component for react applications

Latest version **4.0.0** (published 2026-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vtaits/react-paginator
pnpm add @vtaits/react-paginator
yarn add @vtaits/react-paginator
bun add @vtaits/react-paginator
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-11-10 |
| First published | 2019-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 56.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Vadim Taits |
| Maintainers | vtaits |
| Keywords | react, ui, pagination, paginator |

## Links

- npm: https://www.npmjs.com/package/@vtaits/react-paginator
- Repository: https://github.com/vtaits/react-paginator
- Homepage: https://github.com/vtaits/react-paginator#readme
- Issues: https://github.com/vtaits/react-paginator/issues
- npm.io page: https://npm.io/package/@vtaits/react-paginator

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 4.0.0 (latest) — 2026-11-10
- 3.0.0 — 2025-06-12
- 2.0.0 — 2023-07-12
- 1.0.1 — 2023-04-25
- 1.0.0 — 2023-04-25
- 0.2.1 — 2022-05-05
- 0.2.0 — 2020-11-26
- 0.1.3 — 2020-05-31
- 0.1.2 — 2020-04-15
- 0.1.1 — 2020-01-14
- 0.1.0 — 2019-12-16

## README

[![NPM](https://img.shields.io/npm/v/@vtaits/react-paginator.svg)](https://www.npmjs.com/package/@vtaits/react-paginator)
![dependencies status](https://img.shields.io/librariesio/release/npm/@vtaits/react-paginator)

# @vtaits/react-paginator

Simple customizable pagination component for react applications based on replacable components

## Sandbox examples

- [Simple](https://codesandbox.io/s/3cvut)
- [Few pages](https://codesandbox.io/s/rv12j)
- [Custom styles](https://codesandbox.io/s/g1358)
- [Custom components](https://codesandbox.io/s/58tvx)

## Installation

```
npm install @vtaits/react-paginator --save
```

or

```
yarn add @vtaits/react-paginator
```

or

```
bun add @vtaits/react-paginator
```

### Don't forget to import styles

```
import '@vtaits/react-paginator/styles.css';
```

## Usage

```typescript
import { useState } from 'react';

import { Paginator } from '@vtaits/react-paginator';
import '@vtaits/react-paginator/styles.css';

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

  return (
    <Paginator
      page={page}
      pageCount={15}
      onPageChange={setPage}
    />
  );
}
```

## Props

| Name                 | Type                         | Description                                                                                  | Default value |
| -------------------- | ---------------------------- | -------------------------------------------------------------------------------------------- | ------------- |
| page                 | `number`                     | **Required**. Current page number. Starts from 1.                                            |               |
| pageCount            | `number`                     | **Required**. The total number of pages.                                                     |               |
| onPageChange         | `(nextPage: number) => void` | Callback of current page change.                                                             |               |
| pageRangeDisplayed   | `number`                     | The range of pages displayed.                                                                | 5             |
| marginPagesDisplayed | `number`                     | The number of pages to display for margins.                                                  | 2             |
| previousLabel        | react node                   | Label for the previous button.                                                               | `'prev'`      |
| nextLabel            | react node                   | Label for the next button.                                                                   | `'next'`      |
| breakLabel           | react node                   | Label for break between buttons.                                                             | `'...'`       |
| hrefBuilder          | `(page: number) => string`   | The method is called to generate the `href` attribute value on tag `a` of each page element. | `undefined`   |
| components           | `Object`                     | Custom components                                                                            | `undefined`   |
| styles               | `Object`                     | Custom styles                                                                                | `{}`          |
| payload              | generic                      | Additional prop for custom components and styles                                             | `undefined`   |

## Styling

### With custom styles

Redefining like in [react-select](https://react-select.com/styles).

```typescript
import { useState } from 'react';

import { Paginator } from '@vtaits/react-paginator';
import '@vtaits/react-paginator/styles.css';

const styles = {
  container: (_props) => ({
    backgroundColor: '#EEE',
    padding: 10,
  }),

  pageLink: (_props) => ({
    borderWidth: 0,
    marginLeft: 0,
  }),
};

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

  return (
    <Paginator
      page={page}
      pageCount={15}
      onPageChange={setPage}
      styles={styles}
    />
  );
}
```

#### Style keys

- `break`
- `container`
- `nextLink`
- `pageLink`
- `pageLinkGroup`
- `pages`
- `previousLink`

### With custom components

Redefining like in [react-select](https://react-select.com/components).

```typescript
import { useState } from 'react';

import { Paginator } from '@vtaits/react-paginator';
import '@vtaits/react-paginator/styles.css';

function PageLink({
  page,
  isCurrent,
  rootProps,
}) {
  return (
    <label
      style={{
        textAlign: 'center',
        padding: '0 4px',
      }}
    >
      <div>
        {page}
      </div>

      <div>
        <input
          type="radio"
          onChange={() => {
            rootProps.onPageChange(page);
          }}
          checked={isCurrent}
        />
      </div>
    </label>
  );
}

const components = {
  PageLink,
};

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

  return (
    <Paginator
      page={page}
      pageCount={15}
      onPageChange={setPage}
      components={components}
    />
  );
}
```

#### Components keys

- `Break`
- `Container`
- `Link`
- `NextLink`
- `PageLink`
- `PageLinkGroup`
- `Pages`
- `PreviousLink`

---
_Source: https://npm.io/package/@vtaits/react-paginator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
