Formulários

VTextarea

Componentev-model11 exemplos16 propsA2UI · Textarea

Campo multilinha com auto-resize, contador de caracteres, helper e erro.

Importação
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

Uso

Exemplo
<script setup lang="ts">

</script>

<template>
  
</template>

Playground

Os controles abaixo são gerados a partir das props declaradas em VTextarea.types.ts; o código acompanha cada mudança.

Exemplos

Variantes, tamanhos e estados, extraídos das stories da biblioteca.

Default

Variação Padrão. Estado padrão do componente; use a aba Controls para experimentar as props ao vivo. Props: label="Your message", placeholder="Enter your text...".

Ver código
vue
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

<template>
  <VTextarea
    v-model="value"
    placeholder="Enter your text..."
    label="Your message"
    helper-text="We usually reply within one business day." />
</template>

Auto Resize

Variação Auto Resize. Interativo: o estado é mantido na própria story (v-model).

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

const message = ref('This textarea grows automatically as you type...')
</script>

<template>
  <VTextarea
    v-model="message"
    label="Notes or feedback"
    placeholder="Share your thoughts..."
    :auto-resize="true"
    helper-text="Use auto-resize for a better writing experience." />
</template>

With Counter

Character counter with helper text; the count updates as you type.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

const args = {
  size: 'md',
  placeholder: 'Write a short bio...',
  label: 'Short bio',
  counter: 160,
  helperText: 'Shown on your public profile.'
}
const bio = ref('Product designer based in Lisbon. I care about accessible, well-crafted interfaces.')
</script>

<template>
  <VTextarea v-bind="args" v-model="bio" />
</template>

Over Limit

Counter turns to the error color when the limit is exceeded.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

const args = {
  size: 'md',
  placeholder: 'Enter your text...',
  label: 'Tagline',
  counter: 40,
  errorMessage: 'Tagline must be 40 characters or fewer.'
}
const text = ref('This text is intentionally longer than the allowed limit for this field.')
</script>

<template>
  <VTextarea v-bind="args" v-model="text" />
</template>

Error

Required field with a validation message.

Ver código
vue
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

<template>
  <VTextarea
    v-model="value"
    placeholder="Share your thoughts..."
    label="Your message"
    error-message="Please enter a message."
    required />
</template>

Disabled

Variação Desabilitado. Props: label="Your message", placeholder="Your message...", disabled=true.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

const value = ref('Comments are closed for this thread.')
</script>

<template>
  <VTextarea
    v-model="value"
    placeholder="Enter your text..."
    label="Your message"
    helper-text="You no longer have permission to edit this field."
    disabled />
</template>

Sizes

Variação Tamanhos.

Ver código
vue
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

<template>
  <div style="display:flex;flex-direction:column;gap:16px;max-width:420px">
    <VTextarea size="sm" label="Small" placeholder="Your message..." />
    <VTextarea size="md" label="Medium" placeholder="Your message..." />
    <VTextarea size="lg" label="Large" placeholder="Your message..." />
  </div>
</template>

Readonly

Variação Somente leitura. Props: label="Read only", modelValue="Read only content.", readonly=true.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

const value = ref('Read only content.')
</script>

<template>
  <VTextarea
    v-model="value"
    placeholder="Enter your text..."
    label="Read only"
    readonly />
</template>

Rows Required

Variação Rows obrigatório. Props: rows=6, required=true, label="Descrição".

Ver código
vue
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

<template>
  <VTextarea
    v-model="value"
    placeholder="Enter your text..."
    label="Descrição"
    :rows="6"
    required />
</template>

Feedback Form

Realistic usage: required field with helper, counter and auto-resize.

Ver código
vue
<script setup lang="ts">
import { ref } from 'vue'
import { VTextarea } from 'vueui-nova-kit'

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

<template>
  <VTextarea
    v-model="feedback"
    label="What could we improve?"
    placeholder="Describe your experience..."
    helper-text="Be as specific as you like."
    :counter="300"
    :auto-resize="true"
    :rows="3"
    required />
</template>

Resize

Resize behavior: none, vertical (default) and auto-resize.

Ver código
vue
<script setup lang="ts">
import { VTextarea } from 'vueui-nova-kit'
</script>

<template>
  <div style="display:flex;flex-direction:column;gap:16px">
    <VTextarea label="No resize" resize="none" placeholder="Fixed size" />
    <VTextarea label="Vertical" resize="vertical" placeholder="Drag the corner" />
    <VTextarea label="Auto resize" :auto-resize="true" placeholder="Grows as you type" />
  </div>
</template>

Acessibilidade

Checklist literal ("Accessibility — Built with accessibility in mind"):

  • ARIA compliant (aria-labelledby, aria-describedby).
  • Keyboard navigation (Tab, Shift+Tab).
  • Screen reader friendly.
  • Proper error announcement.
  • Resizable via keyboard.
  • Supports required and read-only states.

Estados

Empty · Hover · Focus · Typing · Filled · Invalid · Disabled · Read-only.

Motion

Auto-resize com transição suave de altura; hover/focus em 100ms ease-out.

Todas as transições respeitam prefers-reduced-motion e os tokens --v-duration-*.

Props

PropTipoDefaultDescrição
modelValuestring""—
labelstring——
helperTextstring——
errorMessagestring——
placeholderstring——
disabledbooleanfalse—
readonlybooleanfalse—
requiredbooleanfalse—
sizeVTextareaSize"md"—
counternumber——
autoResizebooleanfalse—
rowsnumberundefined—
namestring——
idstring——
spellcheckboolean——
resize'none' | 'both' | 'horizontal' | 'vertical'
"none" | "vertical" | "horizontal" | "both"
"vertical"—

Events

EventoPayloadDescrição
@update:modelValuevalue: string—
@focuspayload: FocusEvent—
@blurpayload: FocusEvent—

Slots

Sem slots.

Fonte: src/components/form/VTextarea/VTextarea.vue · tipos: src/components/form/VTextarea/VTextarea.types.ts