GitHub
Core
Glass
Brutal
Humanist

Text Area

Text areas allow users to enter and edit multi-line text. They support floating labels, character counters, validation states, and are resizable.

TextArea Playground

TextArea Playground
Preview
Code
0/500
Controls
Status:
Default
Error
Success
Counter:
Auto Grow:
Disabled:
Trailing Icon:
Supporting Text:
Floating Label:

Installation

You can add the text area component to your project manually:

1

Install the following dependencies:

npm install class-variance-authority clsx tailwind-merge @phosphor-icons/react
2

Copy and paste the following code into your project.

Loading source code...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

import { TextArea } from '@versaui/ui/components/TextArea';

<TextArea label="Message" placeholder="Enter your message..." />

Character Counter

Show a counter with optional max length:

<TextArea
  label="Bio"
  placeholder="Tell us about yourself..."
  showCounter
  maxLength={250}
/>

Validation States

Set status to show validation states:

<TextArea
  label="Description"
  status="error"
  errorText="Description is required"
/>

<TextArea
  label="Notes"
  status="success"
  helperText="Your notes have been saved"
/>

Floating Label

// With floating label (default)
<TextArea label="Comments" showFloatingLabel />

// Without floating label
<TextArea
  label="Comments"
  showFloatingLabel={false}
  placeholder="Add a comment..."
/>

Disabled and Read-Only

<TextArea label="Archived Notes" disabled value="These notes are read-only" />
<TextArea label="Summary" readOnly value="This is read-only content" />

Auto Grow

The text area automatically expands to fit text lines up to maxHeight (default 240px), then enables internal scrolling. Auto-grow can be disabled for fixed height:

<TextArea label="Fixed Height" autoGrow={false} rows={4} />

Accessibility

  • Uses native <textarea> for full accessibility
  • Floating label serves as accessible label
  • Error and helper text linked via aria-describedby
  • Required state announced via aria-required
  • Focus ring visible on keyboard navigation

TextArea Props

PropTypeDefaultDescription
labelstring''Floating label text.
placeholderstring'Placeholder'Placeholder text.
status'default' | 'error' | 'success''default'Validation status.
helperTextstring—Helper text below input.
errorTextstring—Error text (shown on error status).
disabledbooleanfalsePrevents interaction.
readOnlybooleanfalseRead-only state.
requiredbooleanfalseMark as required.
autoGrowbooleantrueAutomatically grows height to adapt to content up to maxHeight.
maxHeightnumber | string240Maximum height of the container in px before internal scrolling begins.
showFloatingLabelbooleantrueUse floating label animation.
showCounterbooleantrueShow character counter.
showResizeIconbooleantrueShow resize handle (when autoGrow is false).
maxLengthnumber200Maximum character count.
rowsnumber—Initial number of rows when autoGrow is false.

On this page