Components/Viewport

Viewport

A scrollable content pane with optional soft-wrapping — ideal for long text, logs or file content. Also powers the one-shot pager() helper.

Install the package

Every component ships in the single dart_tui package.

$dart pub add dart_tui
viewport · dart_tui
Viewport demo

ViewportModel

PropertyTypeDescription
contentStringText to display.
widthintViewport width in columns. Defaults to 80.
heightintViewport height in rows. Defaults to 24.
yOffset / xOffsetintCurrent scroll position.
softWrapboolWrap long lines to the viewport width.

Keybindings

↑ / ↓, k / jScroll line
pgup / pgdnScroll page

Related