All specs
Interactive · pager

pager

Interactive scrollable viewport for long content.

When to use

Use pager when output exceeds the terminal height — long help text,

large tables, generated reports, file previews. If the content fits

the viewport, pager prints directly without entering interactive mode.

Anatomy

H E L P

  Usage: my-cli <command> [options]

  Commands:
    init       Scaffold a new project
    build      Build for production
    deploy     Deploy to cloud
    ...

↑↓/jk scroll  ctrl+u/d page  g/G top/bottom  q quit  42%

API

await pager({
  content: helpText,
  title: 'Help',
})

await pager({
  content: fs.readFileSync('CHANGELOG.md', 'utf8'),
  title: 'Changelog',
  height: 20,
})

### Options

KeyTypeDefaultDescription
contentstringFull text to display
titlestring?Tracked CAPS heading at top
heightnumber?terminal rows − 3Visible line count

Keyboard

KeyAction
↑ / kScroll up one line
↓ / jScroll down one line
Ctrl+UScroll up half page
Ctrl+DScroll down half page
gJump to top
GJump to bottom
q / EscExit pager

Short-circuit

When the content fits the viewport (lines.length ≤ height), pager

prints the content directly to stdout and returns immediately — no

interactive mode, no Ink render.

Progress indicator

A percentage indicator in the footer shows scroll position:

Math.round(((offset + height) / totalLines) * 100) + '%'

Tokens

colors.accent, typography (tracking)