TextArea

A multi-line native text editor.

TextArea rendered by Tarve TextArea rendered by Tarve
Native render. The live version loads when this comes into view.

Import

import { TextArea } from "@tarve/core";

Usage

TextArea.tsx
import { TextArea } from "@tarve/core";

let notes = "";

<TextArea
  value={notes}
  placeholder="Write something…"
  submitOnEnter={false}
  onChange={(value) => {
    notes = value;
  }}
  style={{ width: 380, height: 160 }}
/>

Props

PropTypeDefault
autoFocus

Focus the area when it first appears (HTML `autofocus`).

boolean—
disabled boolean—
followTail

Keeps the end in view as `value` grows while the area is scrolled to its end, as `<Scroll followTail>`: scrolling up stops it, scrolling back to the end resumes it.

boolean—
maxLength

The most characters the user can bring the value to (HTML `maxlength`): typing past it is dropped, a paste is cut to fit.

number—
onChange (value: string) => void—
onSubmit (value: string) => void—
placeholder string—
readOnly

Focusable, selectable, copyable and scrollable, but the user cannot edit it (HTML `readonly`): a log or a preview. The app can still change `value`.

boolean—
submitOnEnter

When true, Enter submits and Shift+Enter inserts a newline. Ctrl/Cmd+Enter always submits.

boolean—
value string—

Common props

Shared by every component. See descriptions →

childrenclassclassNamehighlightidkeymotionFromonHighlightonPasteonPointerLeaveonPointerMoveonSizeonTransitionEndrovingGroupstyle