All specs
Interactive · scrollable

Scrollable

A scrollable viewport container with scroll indicator.

Anatomy

Build output

Compiling TypeScript…          ▎
Bundling 14 modules…           ▎
Minifying assets…
Writing dist/index.js

↑↓/jk scroll  ctrl+u/d page  g/G ends  q quit  42L  68%

Usage

await scrollable({
  content: longBuildOutput,
  height: 15,
  title: 'Build output',
})

// Also accepts string[]
await scrollable({
  content: logLines,
  lineNumbers: true,
})

Options

KeyTypeDefaultDescription
content`string \string[]`Content to display
heightnumber?rows − 4Visible height in lines
titlestring?Title above viewport
lineNumbersboolean?falseShow line numbers
showScrollbarboolean?trueShow scroll indicator

Keyboard

KeyAction
/ kScroll up one line
/ jScroll down one line
Ctrl+UHalf page up
Ctrl+DHalf page down
gJump to top
GJump to bottom
qQuit
escQuit

Differences from pager

Feature`pager``scrollable`
Scroll indicatorNoYes (▎ on right edge)
Line numbersNoOptional
TitleTracked CAPSPlain bold
Input formatString onlyString or string[]

Out of scope

Horizontal scrolling

Search within content

Live/streaming content