# Pager

> A two-link pager for a feed paged in time or a sequence read in order, built from parts: "Newer" and "Older", or "Previous" and "Next", at the two ends of one row with an arrow pointing each way, stacked when narrow.

```ts
import { Pager } from "@sdxc/ui";
```

Renders a `<nav>` laid out as three columns, so Pager.Previous and Pager.Next
each stay at their own end whether or not the other exists, with a Pager.Status centred
between them; under 30rem wide the links stack. Restyle through Pager.CustomProperties.

## Examples

```tsx
<Pager>
	<Pager.Previous href="/?page=1">Newer</Pager.Previous>
	<Pager.Status>Page 2 of 5</Pager.Status>
	<Pager.Next href="/?page=3">Older</Pager.Next>
</Pager>
```

```tsx
<Pager layout="stack">
	<Pager.Previous href="/posts/one"><Pager.Caption>Previous</Pager.Caption><Pager.Label>The first post</Pager.Label></Pager.Previous>
</Pager>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `layout?` | `"row" \| "stack" \| "auto"` | How the links sit. `"auto"` makes the root a size container, so give it a width of its own inside a shrink-to-fit parent. |

Also accepts everything in `TagProps<"nav">`.


### Pager.Previous

The link at the row's start, with an arrow pointing back; its words stack at its start.

Takes no props of its own.

### Pager.Next

The link at the row's end, with an arrow pointing forward; its words stack at its end.

Takes no props of its own.

### Pager.Caption

A small line over a link's label naming the direction, such as "Previous" over a post title.

Takes no props of its own.

### Pager.Label

What a link says under its caption, such as "Older" or the title of the post it leads to.

Takes no props of its own.

### Pager.Status

Where the reader is, centred between the links, such as "Page 2 of 5".

Takes no props of its own.

## Types

| Name | Values | What it decides |
| --- | --- | --- |
| `Layout` | `"row" \| "stack" \| "auto"` | How the links sit: `"row"` at the two ends of one line, `"stack"` previous above next, each full width, and `"auto"` a row that stacks when the pager itself is under 30rem. |
