Skip to content

Textarea

Multi-line text input with InputWrapper styling. Supports prefix icon and programmatic control.

Import

typescript
import { Textarea } from 'vuiii'

Basic Usage

vue
<Textarea v-model="description" placeholder="Enter description..." />

Props

PropTypeDefaultDescription
modelValuestring-Bound value (use with v-model)
prefixIconstring-Icon name to show before the textarea
size'small' | 'normal' | 'large''normal'Textarea size
invalidbooleanfalseApplies the invalid/error styling
pillbooleanfalseRounded pill shape
disabledbooleanfalseDisables the textarea
readonlybooleanfalseMakes the textarea read-only
rowsnumber | string-Number of visible rows (native attribute)

Slots

SlotDescription
prefixContent before the textarea (replaces prefixIcon)

Events

EventPayloadDescription
prefix-icon-click-When the prefix icon is clicked

Rows

rows passes straight through to the native element, so it sets the initial height.

vue
<Textarea v-model="content" placeholder="Write your message..." rows="5" />

With a Prefix Icon

vue
<Textarea v-model="notes" prefix-icon="pencil" placeholder="Notes..." />

Validation State

invalid draws the error styling. Pair it with FormGroup to show the message alongside it — see Composing Forms.

vue
<Textarea v-model="bio" :invalid="!!errors.bio" placeholder="Bio" />

Sizes

vue
<Textarea v-model="value" size="small" placeholder="Small" />
<Textarea v-model="value" size="normal" placeholder="Normal" />
<Textarea v-model="value" size="large" placeholder="Large" />

Programmatic Focus

A template ref exposes focus() and select().

vue
<script setup>
import { ref } from 'vue'
import type { TextareaRef } from 'vuiii'

const textareaRef = ref<TextareaRef>()

function focusIt() {
  textareaRef.value?.focus()
}
</script>

<template>
  <Textarea ref="textareaRef" v-model="notes" />
</template>

Storybook

For interactive examples with all variants, see Textarea in Storybook.

Released under the MIT License.