Skip to content

Pager

Previous/next page navigation bar with arrow indicators.

Preview

Installation

$pnpm exec dgadd add ui/pager
[Installs to]src/components/ui/pager[Item]ui/pager

dgadd ships in @diffgazer/add on npm: pnpm add -D @diffgazer/add puts it on pnpm exec, and npx @diffgazer/add runs it without the install.

UI components require Tailwind CSS v4. Local copy mode imports src/styles/styles.css; package mode uses @diffgazer/ui CSS from the installed package.

Usage

tsx
import { Pager, PagerLink } from "@/components/ui/pager";export default function PagerDefault() {  return (    <div className="mx-auto w-full max-w-2xl">      <Pager>        <PagerLink direction="previous" href="/ui/components/button">          Button        </PagerLink>        <PagerLink direction="next" href="/ui/components/checkbox">          Checkbox        </PagerLink>      </Pager>    </div>  );}

Examples

Single Direction

Preview

Long Titles

Preview

Hover and Focus

Preview

Framework Link (render prop)

Preview

API Reference

Pager

NameTypeDefaultDescription
childrenReactNode—PagerLink children. Rendered inside <nav aria-label="Page navigation">.
NameTypeDefaultDescription
directionrequired"previous" | "next"—Selects the arrow glyph, rel attribute (prev/next), and alignment.
hrefstring—Anchor href. Omit when rendering a framework Link via the render-prop form.
childrenrequiredReactNode | (props: PagerLinkRenderProps) => ReactNode—Link label, or a render function that receives ref, className, rel, direction, and remaining anchor props for framework Link integration.

Accessibility

Notes

Page Spacing

Pager renders only the top rule and the link row. Vertical spacing from the content above is a page decision — add it at the call site (for example className="mt-8").

Link Navigation

Use PagerLink with a direction prop for standard anchor links. For framework-specific link components (TanStack Link, Next.js Link), use the render-prop pattern: <PagerLink direction="next">{(props) => <Link {...props} to="...">text</Link>}</PagerLink>.

Source

Install via CLI: pnpm exec dgadd add ui/pager.

Highlighted source loads after this disclosure opens. Browse the source repository.