WlTextarea
Size and density
Full example
<div class="wl-stack" data-space="md">
<WlTextarea
v-model="value"
aria-label="Material description"
:rows="3"
auto-resize
/>
</div>States
Full example
<div class="wl-stack" data-space="md">
<WlTextarea
v-model="value"
aria-label="Material description"
:rows="3"
auto-resize
/>
</div>Rows, height and error
Fixed height through rows or content height through autoResize. Shared model, adding rows, required comment and clearing.
Fixed rows and content height
Error and unavailable field
Description length: 45 characters.
Full example
<script setup lang="ts">
import { WlButton, WlField, WlTextarea } from "legato-ui";
import { ref } from "vue";
const text = ref("Briefly describe the task.\nAdd the next step.");
const comment = ref("");
</script>
<template>
<div class="wl-stack" data-space="xl" data-input-example="WlTextarea">
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Fixed rows and content height" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField id="docs-textarea-fixed" v-slot="{ id }" label="Description, 4 rows">
<WlTextarea :id="id" v-model="text" :rows="4" />
</WlField>
<WlField
id="docs-textarea-grow"
v-slot="{ id, ariaDescribedby }"
label="Description with content height"
hint="Add lines: the height grows with the text."
><WlTextarea
:id="id"
v-model="text"
:rows="2"
auto-resize
:aria-describedby="ariaDescribedby"
/></WlField>
</div>
</section>
<section class="wl-stack" data-space="md">
<h3 class="wl-text-subheading">{{ "Error and unavailable field" }}</h3>
<div class="wl-grid" data-space="lg">
<WlField
id="docs-textarea-comment"
v-slot="{ id, ariaDescribedby, invalid, required }"
label="Comment"
:error="comment.trim() ? undefined : 'Add a comment.'"
required
><WlTextarea
:id="id"
v-model="comment"
:invalid="invalid"
:required="required"
:aria-describedby="ariaDescribedby"
placeholder="What needs clarification?"
/></WlField>
<WlField id="docs-textarea-disabled" v-slot="{ id }" label="Closed comment">
<WlTextarea :id="id" model-value="Discussion completed." disabled />
</WlField>
</div>
<div class="wl-inline" data-space="sm">
<WlButton size="sm" @click="text += '\nAnother item.'">{{ "Add line" }}</WlButton>
<WlButton size="sm" @click="text = ''; comment = ''">{{ "Clear text" }}</WlButton>
</div>
<p class="wl-text-small" role="status">{{
"Description length:"
}} {{
text.length
}} {{
"characters."
}}</p>
</section>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
v-model: stringText (default "").
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
invalid | boolean | false | Error state. |
disabled | boolean | false | Disables the field. |
rows | number | 3 | Row count. |
autoResize | boolean | false | Adjust height to content. |
placeholder | string | Not set | Placeholder. |
pt | WlPt< | Not set | Attributes of internal Legato UI elements. |
maxRows | number | Not set | Maximum visible textarea rows when automatic resizing is enabled. |
size | WlSizeSm | "md" | Size within the component family's documented scale. |
density | WlDensity | "default" | Spacing density for this component family. |
showCount | boolean | Not set | Display the text length counter and connect it to the control description. |
Events
| Event | Payload | When emitted |
|---|---|---|
update:modelValue | string | Emitted when the component requests a model change; the payload is the next value. |
Slots
No public slots.
Pass-through: pt
Sections WlTextarea are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
counter | span.wl-input-counter | Character count associated with the input. |
root | textarea | The root section in WlConfig.pt.textarea configuration. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Associate a label with the textarea using id/for, or set aria-label; a placeholder remains an additional hint.
- Enter inserts a new line. rows sets the initial row count; autoResize adjusts height to content.
- The model is a string; the application sets required validation and error text. Pass required, invalid and aria-describedby as needed.
- Preserve standard text-editing shortcuts. disabled makes the field unavailable for editing.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesChanges are emitted through v-model. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.