v1.1.8

TextArea

Displays a multi-line text input field.

Default

Basic textarea.

html
<textarea
  placeholder="Type your message here."
  rows="4"
  class="uc-textarea">
</textarea>

With Label

Textarea with label and description.

html

You can use up to 160 characters.

<div class="uc-space-y-2">
  <label>Bio</label>
  <textarea
    placeholder="Tell us a little bit about yourself"
    rows="4"
    class="uc-textarea">
  </textarea>
  <p class="uc-text-sm uc-text-fg-disabled">You can use up to 160 characters.</p>
</div>

Disabled

Textarea in disabled state.

html
<textarea
  placeholder="This textarea is disabled."
  rows="3"
  disabled
  class="uc-textarea uc-resize-none">
</textarea>

With Character Count

Textarea showing remaining characters.

html
0/160
<div class="uc-space-y-2">
  <label>Description</label>
  <textarea
    id="charcount-textarea"
    placeholder="Describe your project..."
    rows="4"
    maxlength="160"
    oninput="document.getElementById('char-count').textContent = this.value.length"
    class="uc-textarea">
  </textarea>
  <div class="uc-flex uc-justify-end">
    <span class="uc-text-xs uc-text-fg-disabled">
      <span id="char-count">0</span>/160
    </span>
  </div>
</div>

Error State

Textarea with validation error.

html

Message must be at least 10 characters.

<div class="uc-space-y-2">
  <label>Message</label>
  <textarea
    rows="3"
    class="uc-textarea uc-textarea-error">Short</textarea>
  <p class="uc-text-sm uc-text-accents-red">Message must be at least 10 characters.</p>
</div>

Form Example

Textarea in a feedback form context.

html
<div class="uc-space-y-4">
  <div class="uc-space-y-2">
    <label>Subject</label>
    <input type="text" placeholder="What is this about?" class="..." />
  </div>
  <div class="uc-space-y-2">
    <label>Message</label>
    <textarea
      placeholder="Your feedback..."
      rows="5"
      class="uc-textarea">
    </textarea>
  </div>
  <div class="uc-flex uc-justify-end uc-gap-2">
    <button class="...">Cancel</button>
    <button class="...">Send Feedback</button>
  </div>
</div>

API Reference

All CSS classes available for the TextArea component.

Class Type Description
uc-textarea Base Full textarea styling -- flex, w-full, rounded-lg, border, bg, padding, text, placeholder, focus ring, resize-y, min-height
uc-textarea-error State Error state -- red border and red focus ring
uc-resize-none Modifier Disable resize (used with disabled)
uc-resize-y Modifier Allow vertical resize only (included in uc-textarea)

Accessibility

Keyboard and screen reader support.

Feature Details
Label Always provide a visible label linked via for/id
Error Use aria-invalid="true" and aria-describedby for error messages
Required Use required attribute for mandatory textareas
Character count Announce remaining characters via aria-live="polite"
Resize Auto-resize should not cause content to jump unexpectedly