Skip to main content
Textarea is a fully featured multi-line text editor. It supports cursor movement across wrapped lines, word-level operations, optional line numbers, a scrolling viewport, and separate focused/blurred styles.

Quick start

Constructor

Creates a textarea with default dimensions (80 × 6), blurred style, and no placeholder.

Reading and setting content

Focus and blur

The focused and blurred states use distinct lipgloss styles that you can override:

Width and height

When content exceeds the visible height, the textarea scrolls automatically to keep the cursor in view.

Placeholder

The placeholder is rendered using the placeholder style (dim by default) and disappears as soon as any content is entered.

Character limit

Line numbers

When line numbers are enabled, the effective content width is reduced by the width of the line number gutter. Increase setWidth() accordingly.

Custom prompt

The prompt character appears at the start of each line. You can provide a static string or a dynamic function:

Line info

Inspecting state

Key bindings

Text input

Single-line text input.

Viewport

Scrollable read-only content area.