Skip to content

Textarea

Provides a multi-line text input field with support for labels, captions, validation, and styling.

First release: 1.0.0 Latest update: July 1, 2025 Current version: 1.0.0

React Angular Vue Svelte HTML

Import

import { PlusTextarea } from '@plusui/react';
import { PlusTextareaComponent } from '@plusui/angular';
import { PlusTextarea } from '@plusui/vue';
import PlusTextarea from '@plusui/svelte';
<script src="https://cdn.jsdelivr.net/npm/@plusui/core"></script>

Package

@plusui/react
@plusui/angular
@plusui/vue
@plusui/svelte
@plusui/core

Docs

Changelog

Textarea Changelog

Recent changes and updates for the textarea component

v1.0.0

June 20, 2025
Feat

Added Textarea component for multi-line input

  • Resizable textarea with size controls
  • Character count and limits
  • Validation with error messages
  • Auto-resize functionality
  • Form integration

The Textarea (plus-textarea) component allows users to enter multi-line text. It includes features like labels, captions, validation states (error, required), character limits, and size variations.

Textarea - anatomy

A simple textarea with a placeholder.

Show code
Show console

Use the label prop for a visible label and caption for helper text below the textarea.

Show code

Control the size of the textarea using the size prop.

Show code

Use disabled to prevent interaction or readonly to prevent editing.

Show code

Set the error prop to indicate an invalid state. The caption will display the error message (either the default browser validation message, the error-message prop if provided, or the standard caption if no validation error exists).

Show code

Mark the textarea as required using the required prop.

Show code
Show console

Use minlength and maxlength to enforce character counts.

Show code

Set the initial visible number of lines using the rows attribute.

Show code

Control how the textarea can be resized using the resize prop.

Show code

Allow the textarea to expand to the full width of its container using the full-width attribute.

Show code
Textarea - layout spacing Textarea - light & dark mode
  • Keyboard Behavior: Standard textarea keyboard interactions apply.
  • Screen Reader:
    • The label prop provides an accessible name.
    • aria-describedby links the textarea to the caption/error message when present.
    • aria-invalid is set when the error prop is true.
    • aria-required is set when the required prop is true.
  • Required Developer Actions:
    • Always provide a meaningful label for accessibility.
    • Use the caption prop for hints or instructions.
    • Use the error and error-message props appropriately to convey validation status.
NameTypeDefaultDescriptionRequired
namestring''The native textarea name attribute.No
valuestring''The current value of the textarea.No
placeholderstring''Placeholder text shown when the textarea is empty.No
size'sm' | 'md' | 'lg''md'The visual size of the textarea.No
disabledbooleanfalseDisables the textarea, preventing interaction and form submission.No
readonlybooleanfalseMakes the textarea read-only, preventing modification but allowing focus.No
requiredbooleanfalseMarks the textarea as required for form submission.No
labelstringundefinedThe visible label text for the textarea.No
minlengthnumberundefinedMinimum number of characters required.No
maxlengthnumberundefinedMaximum number of characters allowed.No
autoFocusbooleanundefinedAutomatically focuses the textarea when the page loads.No
captionstringundefinedHelper text displayed below the textarea.No
errorbooleanfalsePuts the textarea in an error state, usually for validation feedback.No
errorMessagestring''Custom error message to display when error is true. Overrides default.No
fullWidthbooleanfalseAllows the textarea to take the full width of its container.No
rowsnumber4The number of visible text lines for the textarea.No
resize'none' | 'vertical' | 'horizontal' | 'both''vertical'Controls how the textarea can be resized by the user.No
wrap'hard' | 'soft' | 'off''soft'Specifies how the text wraps when submitted in a form.No
NamePayload TypeDescription
plus-inputEventFired immediately when the value changes.
plus-changeEventFired when the value changes and the element loses focus.
plus-focusFocusEventFired when the textarea gains focus.
plus-blurFocusEventFired when the textarea loses focus.
plus-invalidCustomEvent<{ validationMessage: string }>Fired when the textarea fails validation on form submission.

This component does not utilize named slots.

NameParametersReturnsDescription
checkValidity()undefinedbooleanChecks if the current value satisfies validation constraints.
reportValidity()undefinedbooleanChecks validity and displays validation message if invalid.
setCustomValidity()message: stringvoidSets a custom validation message. Clears with empty string.
NameDescription
textareaThe native <textarea> element.
labelThe <label> element.
captionThe <div> containing caption/error text.
NameDescription
--focus-ring-colorColor of the focus ring.
--error-colorColor used for error states.

Join the Community

Plus UI is built by the community. Join us on our platforms to contribute, get help, and stay up to date.