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:
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" />

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.
helperTextstringHelper text below input.
errorTextstringError text (shown on error status).
disabledbooleanfalsePrevents interaction.
readOnlybooleanfalseRead-only state.
requiredbooleanfalseMark as required.
showFloatingLabelbooleantrueUse floating label animation.
showCounterbooleanfalseShow character counter.
showResizeIconbooleantrueShow resize handle.
maxLengthnumberMaximum character count.
rowsnumber3Initial number of rows.

On this page