Skip to content

Text Area

Usage ​

Use TextArea to enter multi-line plain text.

vue
<script setup lang="ts">
import { TextArea } from '@astryx-vue/core/TextArea'
import { shallowRef } from 'vue'

const bio = shallowRef('')
</script>

<template>
  <TextArea v-model="bio" label="Bio" :rows="4" />
</template>

Import the theme once in the application entry:

ts
import '@astryx-vue/themes/neutral.css'

Best practices ​

GuidancePractices
DoProvide a visible label so users know what to enter. If the label must be hidden, set isLabelHidden with a descriptive label for screen readers.
DoSet maxLength with a character counter when there is a defined limit; it helps users stay within bounds before they submit.
DoUse the status prop to surface validation feedback inline: show success when input is valid, warning for soft limits, and error for hard failures.
DoAdd a description or placeholder to clarify expected content, like "Describe the issue in detail," but never rely on placeholder alone as the only label.
Don'tAvoid using TextArea for short, single-line values like names or emails; use TextInput instead.
Don'tDon't rely solely on placeholder text to communicate the purpose of the field; placeholders disappear on focus and are not accessible labels.
Don'tDon't show a status message without also setting the status type; the colored border and icon are what draw the user's attention to the message.
Don'tDon't wrap a disabled TextArea in Tooltip to explain why it's disabled; disabled controls swallow the hover events the wrapper needs. Use the disabledMessage prop instead.

Examples ​

Basic usage

A short introduction.

For longer text. Label, description, and status are linked through Field.

Sizes

Three heights are available: sm, md, and lg. Width is controlled by the width prop.

Rows and length

Maximum 140 characters.

rows, cols, minlength, and maxlength are forwarded to the native textarea.

Disabled and read-only

This value is still included in form submission.
You need the Editor role to edit this field.

Disabled values are not submitted. A disabledMessage keeps the control focusable and explains why.

Validation states

Summary must be at least 20 characters.

status shows an error, warning, or success message. The message is attached below the field by default.

Async save

changeAction runs after each content change. A loading indicator appears while the action is pending.

Keyboard controls ​

The control is a real textarea, so it keeps the browser's native key behaviour, and the component only adds handling on top of a few keys. Most keystrokes therefore behave exactly as they do in any other multi-line field:

  • Tab moves focus into or out of the text area.
  • Shift + Enter inserts a newline at the caret.
  • Enter emits the enter event, so your handler can take over submit-like logic.
  • Escape closes an open disabled reason tooltip or status tooltip.

When submit-on-Enter behaviour makes sense for your form, implement it in the enter handler.

Usage guidance ​

The text area does not constrain what users type, so length limits and validation belong to your application:

  • When the expected length matters, state minlength and maxlength in the description so users know it before they submit.
  • isRequired only shows the required indicator and sets the matching ARIA state; it does not run native validation.
  • Whether the content meets your business rules is up to validation in application code.