Textarea adds styling, key filtering and autoResize functionality to standard textarea element.
import Textarea from 'primevue/textarea';
A model can be bound using the standard v-model directive.
<Textarea v-model="value" rows="5" cols="30" />
When autoResize is enabled, textarea grows instead of displaying a scrollbar.
<Textarea v-model="value" autoResize rows="5" cols="30" />
A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
<FloatLabel>
<Textarea id="over_label" v-model="value1" rows="5" cols="30" style="resize: none" />
<label for="over_label">Over Label</label>
</FloatLabel>
<FloatLabel variant="in">
<Textarea id="over_label" v-model="value2" rows="5" cols="30" style="resize: none" />
<label for="in_label">In Label</label>
</FloatLabel>
<FloatLabel variant="on">
<Textarea id="over_label" v-model="value3" rows="5" cols="30" style="resize: none" />
<label for="on_label">On Label</label>
</FloatLabel>
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
<IftaLabel>
<Textarea id="description" v-model="value" rows="5" cols="30" style="resize: none" />
<label for="description">Description</label>
</IftaLabel>
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
<Textarea v-model="value" variant="filled" rows="5" cols="30" />
Invalid state is displayed using the invalid prop to indicate a failed validation. You can use this style when integrating with form validation libraries.
<Textarea v-model="value" rows="5" cols="30" :invalid="value ===''" />
When disabled is present, the element cannot be edited and focused.
<Textarea v-model="value" rows="5" cols="30" disabled />
Textarea component renders a native textarea element that implicitly includes any passed prop. Value to describe the component can either be provided via label tag combined with id prop or using aria-labelledby, aria-label props.
<label for="address1">Address 1</label>
<Textarea id="address1" />
<span id="address2">Address 2</span>
<Textarea aria-labelledby="address2" />
<Textarea aria-label="Address Details"/>
Key | Function |
---|---|
tab | Moves focus to the input. |