Skip to content

Textarea

Textarea component is used for multi-line text input. It supports auto height, word count, clear and other features.

Platform Compatibility

App(vue)App(nvue)H5Mini Program

Basic Usage

html
<template>
  <seeTextarea v-model="value" placeholder="Please enter content" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Set Rows

Set the default display rows of the textarea via the rows property.

html
<template>
  <seeTextarea v-model="value" :rows="5" placeholder="Textarea with 5 rows height" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Auto Height

Set the isAutoHeight property and the textarea height will automatically adjust based on content.

html
<template>
  <seeTextarea
    v-model="value"
    placeholder="Enter content, height will adjust automatically"
    is-auto-height
  />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Word Limit

Set the isShowWordLimit property to display word count. Must be used together with maxlength.

html
<template>
  <seeTextarea
    v-model="value"
    placeholder="Please enter content"
    maxlength="200"
    is-show-word-limit
  />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Clearable

Set the isClearable property to show a clear button for clearing input content with one click.

html
<template>
  <seeTextarea
    v-model="value"
    placeholder="Clearable textarea"
    is-clearable
  />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('Clearable content')
</script>

Disabled and Readonly

Set disabled and readonly states via isDisabled and isReadonly properties.

html
<template>
  <seeTextarea v-model="value" is-disabled placeholder="Disabled state" />
  <seeTextarea v-model="value" is-readonly placeholder="Readonly state" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>

Sizes

Set textarea size via size property. Supports small, default, large.

html
<template>
  <seeTextarea v-model="value" size="small" placeholder="Small size" />
  <seeTextarea v-model="value" size="default" placeholder="Default size" />
  <seeTextarea v-model="value" size="large" placeholder="Large size" />
</template>

Borderless Mode

Set isBorder to false to hide the textarea border.

html
<template>
  <seeTextarea v-model="value" :is-border="false" placeholder="Borderless textarea" />
</template>

Keyboard Confirm Key

Set the keyboard confirm button text via the confirmType property.

html
<template>
  <seeTextarea v-model="value" confirm-type="done" placeholder="Confirm key is 'Done'" />
</template>

API

Props

ParameterDescriptionTypeDefaultPlatform
modelValueBound valuestring''-
placeholderPlaceholder textstring''-
isDisabledWhether disabledbooleanfalse-
isReadonlyWhether readonlybooleanfalse-
maxlengthMaximum input lengthnumber-1-
isShowWordLimitWhether to show word countbooleanfalse-
rowsDefault display rowsnumber3-
isAutoHeightWhether to enable auto heightbooleanfalse-
isBorderWhether to show borderbooleantrue-
isClearableWhether to show clear buttonbooleanfalse-
sizeSizestring'default'-
nameForm field namestring''-
confirmTypeKeyboard confirm key typestring'done'-

Events

EventDescriptionTypePlatform
onInputTriggered on input(value: string) => void-
onFocusTriggered on focus(event: FocusEvent) => void-
onBlurTriggered on blur(event: FocusEvent) => void-
onClearTriggered when clear button is clicked() => void-
onChangeTriggered when value changes (on blur)(value: string) => void-
onConfirmTriggered when confirm button is clicked(value: string) => void-
onLineChangeTriggered when line count changes(event: { height: number, heightRpx: number, lineCount: number }) => void-

Liao ICP No. 2025070134