Skip to main content
Urbicon UI

Textarea

Multi-line text input with auto-resize, character counter, validation, and semantic variants.

Playground

Tier Style variant (tailwind-variants)
Intent Style variant (tailwind-variants)
Variant
<Textarea
  variant="outlined"
/>

01 Examples

Auto-resizing notes field

Pair autoResize with minRows/maxRows to grow the field as the user writes and cap the height before it dominates the layout.
<Textarea
  label="Notes"
  placeholder="Start typing — the field will grow..."
  autoResize
  minRows={2}
  maxRows={10}
/>

Character-limited composer

Combine maxlength, showCounter, and autoResize for tweet/comment-style inputs. The counter announces remaining characters via aria-live.
0/280
<Textarea
  label="Tweet"
  placeholder="What's happening?"
  maxlength={280}
  showCounter
  autoResize
  minRows={2}
/>

Helper & error

Helper text and error text follow the same form-field contract as Input — error overrides helper when both are set and toggles aria-invalid.
Write a short bio for your profile page
<Textarea
  label="Bio"
  helper="Write a short bio for your profile page"
  placeholder="I'm a..."
/>
<Textarea
  label="Required field"
  error="This field is required"
  placeholder="Cannot be empty"
/>

Feedback Form

Textarea in a realistic form context with bound value and character counter.
0/500

No feedback yet

<div class="border-border-subtle bg-surface-elevated w-full space-y-4 rounded-2xl border p-5">
  <Textarea
    label="Your Feedback"
    placeholder="What could we improve?"
    maxlength={500}
    showCounter
    autoResize
    minRows={3}
    maxRows={8}
    bind:value={feedback}
  />
  <p class="text-text-tertiary text-xs">
    {feedback.length > 0 ? `${feedback.length} characters entered` : 'No feedback yet'}
  </p>
</div>

02 Customization

Code Input

Use slotClasses to create a code-friendly textarea with monospace font.
<Textarea
  label="JSON Config"
  placeholder={'{"key": "value"}'}
  slotClasses={{ base: 'font-mono text-sm' }}
  minRows={5}
/>

Fully Custom (unstyled)

Strip all defaults and build from scratch. All behavioral features still work.
0/200
<Textarea
  unstyled
  autoResize
  maxlength={200}
  showCounter
  placeholder="Minimal textarea..."
  bind:value={bio}
  slotClasses={{
    wrapper: 'flex flex-col gap-1',
    base: 'bg-transparent border-b-2 border-text-tertiary px-0 py-2 text-text-primary placeholder:text-text-quaternary focus-visible:outline-none focus-visible:border-primary resize-none transition-colors',
    footer: 'flex justify-end',
    counter: 'text-xs text-text-tertiary tabular-nums'
  }}
/>

A field treatment shared with Input and Select belongs in a BlocksProvider preset (presets.Textarea) so the whole form speaks one language — see Customization.

03 Accessibility

Labels & Descriptions

The label prop creates an associated <label> element linked via for/id. Helper and error text are linked via aria-describedby, and errors set aria-invalid.

Character Counter

The character counter uses aria-live="polite" to announce remaining characters to screen readers. Color changes at warning/over thresholds are paired with text for non-color-dependent feedback.

Keyboard

Standard textarea keyboard behavior. Focus rings use focus-visible: for keyboard-only visibility. Auto-resize does not interfere with keyboard interaction or scroll position.

Reduced Motion

Mint effects respect prefers-reduced-motion. The auto-resize height adjustment is instantaneous and does not animate.

04 API Reference

23 props
23 props
Prop
Type
Default
Description

05 Types

Local type definitions used by this component.

7 types
Name
Kind
Category
Used by
Description

06 Installation

Import

import { Textarea } from '@urbicon-ui/blocks';