> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/llms-full.txt.

# Pagination

Navigation`@rockshin/tao-ui`

[Examples](#examples)[API](#api)

Moves through paged data with current page and page-size controls.

## When to use

Use Pagination when a collection is split into pages rather than infinitely loaded.

**Recommended**

- Keep the current page controlled when data is loaded remotely.
- Show total counts when they help users judge scope.

**Avoid**

- Do not use the component outside its intended interaction model.

## Examples


### Basic usage
```tsx preview
import { Pagination } from '@rockshin/tao-ui';
import { useState } from 'react';

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

  return (
    <Pagination
      total={95}
      current={page}
      pageSize={10}
      onChange={setPage}
      showTotal={(total, range) => range[0] + '-' + range[1] + ' of ' + total}
    />
  );
}

export default PaginationExample;
```

### Sizes
```tsx preview
import { Pagination, Stack } from '@rockshin/tao-ui';

function PaginationSizes() {
  return (
    <Stack gap="md">
      <Pagination total={50} size="small" />
      <Pagination total={50} size="medium" />
      <Pagination total={50} size="large" />
    </Stack>
  );
}

export default PaginationSizes;
```

### Page size and totals
```tsx preview
import { Pagination } from '@rockshin/tao-ui';
import { useState } from 'react';

function PaginationPageSize() {
  const [page, setPage] = useState(1);
  const [pageSize, setPageSize] = useState(10);

  return (
    <Pagination
      total={200}
      current={page}
      pageSize={pageSize}
      showSizeChanger
      showTotal={(total, range) => range[0] + '-' + range[1] + ' of ' + total}
      onChange={(nextPage, nextPageSize) => {
        setPage(nextPage);
        setPageSize(nextPageSize);
      }}
    />
  );
}

export default PaginationPageSize;
```

### Display totals
`showTotal` can describe the current record range and total count.
```tsx preview
import { Pagination } from '@rockshin/tao-ui';

import { useState } from 'react';

export default function PaginationWithTotal() {
  function Demo() {
    const [page, setPage] = useState(1);
    return (
      <Pagination
        total={95}
        current={page}
        pageSize={10}
        onChange={(p) => setPage(p)}
        showTotal={(t, [s, e]) => `${s}-${e} of ${t}`}
      />
    );
  }
  return <Demo />;
}
```

### Change page size
Maintain page and page size together and use both updated values in a data request.
```tsx preview
import { Pagination } from '@rockshin/tao-ui';

import { useState } from 'react';

export default function PaginationSizeChanger() {
  function Demo() {
    const [page, setPage] = useState(1);
    const [ps, setPs] = useState(10);
    return (
      <Pagination
        total={200}
        current={page}
        pageSize={ps}
        onChange={(p, s) => {
          setPage(p);
          setPs(s);
        }}
        showSizeChanger
      />
    );
  }
  return <Demo />;
}
```

### Pagination sizes
Size controls the density of pagination buttons and can match the surrounding list.
```tsx preview
import { Pagination } from '@rockshin/tao-ui';

export default function PaginationSizes() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
      <Pagination total={50} size="small" />
      <Pagination total={50} size="medium" />
      <Pagination total={50} size="large" />
    </div>
  );
}
```

## API


### [#](#pagination)Pagination



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| disabled | Whether to disable | `boolean | undefined` | `-` |
| className | Additional css class | `string | undefined` | `-` |

