forms

Textarea

Display a textarea field.

Usage

Use a v-model to make the Textarea reactive.

<script setup>
const value = ref('')
</script>
<template>
  <UTextarea v-model="value" />
</template>

Style

Use the color and variant props to change the visual style of the Textarea.

<UTextarea color="primary" variant="outline" />

Besides all the colors from the ui.colors object, you can also use the white (default) and gray colors with their pre-defined variants.

White

<UTextarea color="white" variant="outline" />

Gray

<UTextarea color="gray" variant="outline" />

Size

Use the size prop to change the size of the Textarea.

<UTextarea size="sm" />

Placeholder

Use the placeholder prop to set a placeholder text.

<UTextarea placeholder="Search..." />

Rows

Use the rows prop to set the number of rows of the Textarea.

<UTextarea :rows="1" />

Disabled

Use the disabled prop to disable the Textarea.

<UTextarea disabled />

Autoresize

Use the autoresize prop to enable the autoresize. Writing more lines than the rows prop will make the Textarea grow up.

<UTextarea autoresize />

Resize

Use the resize prop to enable the resize control.

<UTextarea resize />

Props

name
string

null

size
"sm" | "2xs" | "xs" | "md" | "lg" | "xl"

null

ui
any

undefined

id
string

null

placeholder
string

null

color
any

config.default.color

modelValue
string | number

""

variant
"outline" | "none"

config.default.variant

rows
number

3

textareaClass
string

null

required
boolean

false

disabled
boolean

false

autofocus
boolean

false

padded
boolean

true

autoresize
boolean

false

resize
boolean

false

Preset

appConfig.ui.textarea
undefined