Skip to content

Textarea ​

te-textarea is a multi-line field that forwards the same native events as te-input.

Inside a te-field it takes the id its label points at, its description and its invalid state from the wrapper.

Basic ​

vue
<te-textarea placeholder="Leave a comment" :rows="4" />
<te-textarea model-value="Read only" readonly />

Character counter ​

counter shows how much has been typed under the field. With a maxlength it reads x/y and the browser enforces the limit; without one it is a plain count.

It sits at the right edge of the component's box, which is as wide as its parent — so give the field a width (class="w-full", cols) for the two to line up.

0/180
0
vue
<te-textarea class="w-full" placeholder="Leave a comment" :rows="4" :maxlength="180" counter />
<te-textarea class="w-full" placeholder="No limit" :rows="4" counter />

Props ​

PropTypeDefaultDescription
modelValuestring''Supports v-model.
placeholderstring''Placeholder text.
rowsnumber3Visible rows.
colsnumberundefinedVisible columns.
maxlengthstring | numberundefinedCaps the value, and turns the counter into x/y.
counterbooleanfalseShows the character count under the field.
disabledbooleanfalseDisables the field.
readonlybooleanfalseRead-only field.

Events ​

EventPayloadDescription
update:modelValuestringValue changed.
blur focusFocusEventForwarded from the textarea.
changeEventForwarded from the textarea.
keydown keypress keyupKeyboardEventForwarded from the textarea.

Slots ​

SlotPropsDescription
counter{ length, maxlength }Replaces the counter text, for a wording of your own.
vue
<te-textarea :maxlength="180" counter>
  <template #counter="{ length, maxlength }">
    Quedan {{ maxlength - length }} caracteres
  </template>
</te-textarea>