Components/Textarea

Textarea

A multiline text field with a character count and status styles.

VerifiedSince 0.3.7

Usage

Basic

Loading demo...

Best Practices

  • Pair maxLength with showCount for bounded notes, summaries, and prompts.
  • Keep resize="vertical" in ordinary forms; use none only when the layout already controls height.
  • Treat status as a visual hint; keep labels, help text, and validation messages in the surrounding form item.

API Reference

Props

PropTypeDefaultDescription
modelValue / v-modelstring''The text value.
placeholderstring''Placeholder text.
rowsnumber4Native row count.
disabledbooleanfalseNative disabled state.
readonlybooleanfalseNative read-only state.
maxLengthnumber-Native maximum length, also the count's denominator.
showCountbooleanfalseShows the character count; current/max when maxLength is set.
resize'none' | 'vertical' | 'horizontal' | 'both''vertical'CSS resize behavior.
status'default' | 'success' | 'error''default'Visual validation state.

Events

EventParamsDescription
update:modelValue(value: string)Fires on input.
input(value: string)Fires together with update:modelValue.
focus(event: FocusEvent)Native focus event.
blur(event: FocusEvent)Native blur event.

Exposed Methods

MethodDescription
focus()Focuses the native textarea.
blur()Blurs the native textarea.
textareaRefRef to the native textarea.

Overview

  • class and style stay on the root; other attrs (such as id and name) pass through to the inner <textarea>.

Technologies

  • Source: packages/tuffex/packages/components/src/textarea/; exports the TxTextareaInstance type.
查看源码
packages/tuffex/packages/components/src/textarea/index.ts