ORIZEN/TUI
ComponentsViewport

Viewport

stable

Scrollable content area with overflow indicators and keyboard navigation.

Browser preview is a simulation. The copied component runs in actual terminal apps.

viewport.tsx
viewport↑↓ · PgUp/PgDn
> He holds him with a skinny hand,
'There was a ship,' quoth he.
'Hold off! unhand me, grey-beard loon!'
An artichoke, dropt he.
 
--Samuel Taylor Coleridge
 
## Other foods worth mentioning
 
1. Carrots

Installation

npx orizen-tui@latest add viewport

if dependency install fails, run: npm install ink@^5.0.1 react@^18.3.1 @types/react@^18.3.18 orizen-tui-core@latest

Usage

viewport.imports.tsx
viewport.example.tsx

Examples

Usage

viewport.example1.tsx
viewport↑↓ · PgUp/PgDn
> He holds him with a skinny hand,
'There was a ship,' quoth he.
'Hold off! unhand me, grey-beard loon!'
An artichoke, dropt he.
 
--Samuel Taylor Coleridge
 
## Other foods worth mentioning
 
1. Carrots

API Reference

Viewport

lines
string[]

Lines of text to render

height
number

Number of visible lines

widthundefined
number

Fixed column width (optional)

showScrollIndicatortrue
boolean

Show ↑/↓ overflow indicators

focustrue
boolean

Whether to accept keyboard scroll input