# App, pagination

- **[Sections](/blocks/)**
- **[Application](/blocks/app/)**
- **App, pagination**

A pagination row: a summary built from the page, rows per page and the total (it changes with the page and is read out politely), previous and next, numbered pages with…

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/app-data-pagination
  ```
- **Import**

  ```
  import Block from '@/components/klarhimmel/blocks/app-data-pagination';
  ```

Also called

- app/data-pagination

- **About**: A pagination row: a summary built from the page, rows per page and the total (it changes with the page and is read out politely), previous and next, numbered pages with a gap marker, and aria-current.
- **Category**: Interface sections for signed-in products. New project? Set it up once: /get-started/installation.

## Notes

- **When to use it**: A row under a list or table that shows the current range and page numbers. For narrowing a list use `app-data-filters`.
- **Writing for it**: - The summary is built from `showing`, `to`, `of` and `noun`, plus the numbers, so write them as words that fit between numbers, like Showing, to, of and bookings.
- `perPage` and `total` are numbers written as text. The range is computed from the page, so change them together with the `pages` list.
- `pages` takes 3 to 9 labels and a gap is written as the ellipsis character. The `active` label must match one of the entries.
- **Watch out for**: The `title` is not drawn. It only names the navigation landmark, so an empty one leaves the nav unnamed. The block moves the marker and the summary line but never loads rows, so the host has to swap the data.

## Pairs well with

- **[App, data table](/blocks/app/data-table)**
- **[App, filter bar](/blocks/app/data-filters)**
- **[App, search results](/blocks/app/search-results)**

## Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx

```
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import AppDataPagination from '@/components/klarhimmel/blocks/app-data-pagination';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <AppDataPagination props={{
          "title": "Pagination",
          "summary": {
            "showing": "Showing",
            "to": "to",
            "of": "of",
            "noun": "items"
          },
          "perPage": "10",
          "total": "210",
          "pages": [
            "1",
            "2",
            "3",
            "…",
            "21"
          ],
          "active": "2",
          "previous": "Previous",
          "next": "Next"
        }} />
      </BlockSurface>
    </Theme>
  );
}
```

## Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

- **title**: Text, up to 40 characters.
- **summary**: Fields: showing, to, of, noun.
- **perPage**: Text, up to 6 characters.
- **total**: Text, up to 10 characters.
- **pages**: List of 3 to 9.
- **active**: Text, up to 6 characters.
- **previous**: Text, up to 20 characters.
- **next**: Text, up to 20 characters.

[Previous](/blocks/app/data-filters)

[Next](/blocks/app/data-table)
