Textarea

Multiline editing, navigation and selection.

Textarea

Textarea supports multiple lines of text and provides navigation, selection and undo/redo capabilities. Bind it to a reactive signal for two‑way editing.

<textarea
  value={content()}
  onInput={(next) => setContent(next)}
  width="100%"
  height={12}
/>

You can highlight specific ranges programmatically, for example to indicate syntax errors.

<textarea
  value={code()}
  highlights={[{ start: 10, end: 20, color: "yellow" }]}
  onInput={(next) => setCode(next)}
/>

Textarea is also a good foundation for simple editors: pair it with a status bar, line numbers, and a help footer. For complex use cases (syntax highlighting, diffs), combine it with Code and Tree‑sitter.

Props

PropTypeNotes
valuestringControlled content; keep it in state/store.
onInput(value) => voidCalled when the user edits the text.
widthnumber | %Set to "100%" for editor-like panels.
heightnumberPick a fixed height or put it in a flex container.
highlightsrangesHighlight ranges (e.g. errors, search matches).