Skip to content

Textarea

<ts-textarea> vv0.4.0

The ts-textarea component.

Open in Storybook for interactive demos.

<ts-textarea resize="vertical" rows="3" size="md"></ts-textarea>
PropertyAttributeTypeDefaultDescription
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.
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.
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.
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>