MultilineTextInput
A multi-line text input; input capabilities match TextInput.
Basic usage
Rows and auto height
rows is the minimum number of rows (written to the <textarea>'s rows attribute). With autosize on, the height follows the content: it grows until maxRows and turns into internal scrolling beyond that; maxRows defaults to max(2 × rows, 10).
Without autosize, the height stays at rows lines and overflowing content scrolls.
Beyond input, the auto-height re-measure has a size-observer fallback: font loading and container or width changes also trigger a re-measure (the original only re-measures on input, so the height can lag behind).
Scrollbar offset
When a vertical scrollbar appears, the indicator and the label placed after the input shift by the scrollbar width to stay clear of it (always enabled for multiline input; nothing to configure). When the input's direction diverges from the page's (e.g. a dir='rtl' input on an LTR page), the offset is withdrawn entirely, avoiding the label-stretching distortion the original shows in that case.
Line breaks and Enter
Enter always inserts a line break.
The original's allowLinebreaks option (suppressing line breaks and cleaning them into spaces) and its companion enter event (fired on Ctrl/Cmd+Enter) are not provided here — to restrict line breaks, clean the value in onChange.
Capabilities shared with TextInput
The following behave exactly as in TextInput and are not repeated here:
- Label:
label/labelPosition/invisibleLabel; - Icon and indicator:
icon,indicator; whenindicatoris not given explicitly andrequiredis true, it falls back to the required indicator; - Soft validation:
validate(RegExp / function /'non-empty'/'integer'), flags without rewriting the value; - State:
maxLength,readOnly(focusable and copyable),disabled.
Where props land
The component root is a non-focusable <div> and the input element is a <textarea>. The landing rules are the same as TextInput:
...restfrom props lands on the root div; attributes that must go on the native<textarea>(such asrole,aria-*) go through theinputPropschannel, whoseonChange/onBlur/onFocusare chained after the component's own logic.inputRefpoints to the inner<textarea>(the componentrefpoints to the root div); useinputRefto focus the input.tabIndex,title,dir,accessKeyandnameare taken over by the component and land directly on the<textarea>(matching the original's landing spots), not viarest.