# Pager

- Page: <https://kznlabs.github.io/labsUI/components/pager>

## Pager (`pager`, component)

Server-safe links to the previous and next page of a guide or docs site, each with the page's title. Works without JS; on the first or last page the missing side stays empty.

- Install: `npx @kznlabs/labsui add pager`
- Docs: <https://kznlabs.github.io/labsUI/components/pager>
- Brings: link, utils
- npm: clsx@^2.1.1, lucide-react@1.63.0, tailwind-merge@^3.7.0

### API

- `<Pager>` (+ <nav> props): Links to the previous and next page of a guide or docs site, titled so readers know where they lead. Layout follows its container.
  - `label?: string` = `"Pages"`: Accessible name of the navigation.
  - `next?: PagerLink`: The page after this one. Left out on the last page.
  - `nextLabel?: ReactNode` = `"Next"`: Word over the next page's title.
  - `onNavigate?: (href: string, event: MouseEvent<HTMLAnchorElement, MouseEvent>) => void`: `onClick` for both links, e.g. for client routing or to stub links in a demo.
  - `previous?: PagerLink`: The page before this one. Left out on the first page.
  - `previousLabel?: ReactNode` = `"Previous"`: Word over the previous page's title.

- `type PagerLink = { title: ReactNode; href: string; }`

### Usage

```tsx
<Pager previous={{ title: "Install", href: "/docs/install" }} next={{ title: "Theming", href: "/docs/theming" }} />
```

### Example: docs-pager.tsx

```tsx
import { Pager } from "@/components/ui/pager";

export function DocsPager() {
  return (
    <Pager
      label="More guides"
      previous={{ title: "Install", href: "/docs/install" }}
      next={{ title: "Theming", href: "/docs/theming" }}
    />
  );
}
```
