Text Area

Alignment target:@astryxdesign/core v0.7.1 · TextArea

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:

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

Anatomy

ElementDescription
LabelText identifying the multi-line field.
DescriptionHelper text between the label and the input.
Input containerPainted boundary containing the text area and its overlays.
Text areaMulti-line control that displays and edits the value.
PlaceholderHint text shown inside the empty text area.
Start iconAstryx Icon rendered at the start when startIcon is a semantic name or icon component.
Custom start contentCaller-provided slot content rendered at the start instead of an Astryx Icon.
SpinnerLoading indicator shown at the end of the input container.
Status iconError, warning, or success icon shown inside the input.
Character counterCurrent and maximum character counts shown inside the input container.
Field status messageAttached or detached error, warning, or success message associated with the field.
Tooltip status messageTooltip surface presenting the status message for the tooltip variant.

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 #

Text Area — Character count

110/280
Open in Playground

A status update with a 280-character limit and a live counter.

Text Area — States

Open in Playground

Required, disabled, and loading fields.

Text Area — Validation

Description must be at least 20 characters.
Consider adding more detail for clarity.
Looks good — clear and actionable.
Open in Playground

Error, warning, and success messages, plus an error with no message.

Text Area — Icon

Capture key decisions and action items.
Open in Playground

Meeting notes with a pencil icon and a short description.

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.