Skip to content

Textarea

<ts-textarea> vv0.6.3

The ts-textarea component.

Open in Storybook for interactive demos.

<ts-textarea resize="vertical" rows="3" size="md"></ts-textarea>
PropertyAttributeTypeDefaultDescription
autoGrowauto-growbooleanfalseWhether the textarea auto-grows vertically as content is typed.
disableddisabledbooleanfalseRenders the textarea as disabled.
errorerrorbooleanfalseRenders the textarea in an error state.
errorMessageerror-messagestring | undefinedError message displayed below the textarea.
helpTexthelp-textstring | undefinedHelp text displayed below the textarea.
labellabelstring | undefinedLabel text displayed above the textarea.
maxHeightmax-heightstring | undefinedMaximum height for auto-grow mode (e.g., “300px”).
maxlengthmaxlengthnumber | undefinedMaximum character length.
namenamestring | undefinedName attribute for form submission.
placeholderplaceholderstring | undefinedPlaceholder text.
readonlyreadonlybooleanfalseRenders the textarea as readonly.
requiredrequiredbooleanfalseMakes the textarea required.
resizeresize"both" | "horizontal" | "none" | "vertical"'vertical'Resize behavior.
rowsrowsnumber3Number of visible text rows.
showCountshow-countbooleanfalseWhether to show the character counter. Requires maxlength to be set.
sizesize"lg" | "md" | "sm" | "xl" | "xs"'md'The textarea size.
valuevaluestring''The textarea’s value.
EventDetailBubblesComposedDescription
tsBlurvoidYesYesEmitted when the textarea loses focus.
tsChangeTsChangeEventDetail<string>YesYesEmitted when the value changes (on blur / commit).
tsFocusvoidYesYesEmitted when the textarea gains focus.
tsInputTsChangeEventDetail<string>YesYesEmitted on every keystroke.
MethodSignatureDescription
selectTextselectText() => Promise<void>Programmatically select the textarea text.
setFocussetFocus() => Promise<void>Programmatically focus the textarea.

Use ::part() to style internal elements:

PartDescription
baseThe outer wrapper.
counterThe character counter element.
error-textThe error message wrapper.
help-textThe help text wrapper.
labelThe label element.
textareaThe native textarea element.
ts-textarea::part(base) {
/* your custom styles */
}
<ts-textarea resize="vertical" rows="3" size="md"></ts-textarea>
import { TsTextarea } from '@tessera-ui/react';
<TsTextarea resize="vertical" rows="3"></TsTextarea>