Textarea

A React textarea that auto resizes between min and max rows, with a live character count that warns near the limit and default, filled, or ghost styles.

Loading preview

Examples

Practical examples and common states for the same installable component.

Auto Grow

Grow with content until the configured maximum row count.

examples/text-area-auto-grow.tsx
"use client";
import * as React from "react";
import { Textarea } from "@/components/wensity/text-area";
export function TextareaAutoGrow() {
const [value, setValue] = React.useState(
"Auto-grow keeps short notes compact, then expands until the configured maximum row count.",
);
return (
<Textarea
label="Brief"
value={value}
onChange={(event) => setValue(event.target.value)}
autoResize
minRows={3}
maxRows={8}
hint="Try adding more lines; the field grows without layout jumps."
/>
);
}

Filled

Soft filled surface for dense product panels and notes.

examples/text-area-filled.tsx
import { Textarea } from "@/components/wensity/text-area";
export function TextareaFilled() {
return (
<Textarea
variant="filled"
label="Internal note"
defaultValue="The customer asked for workspace-level permissions before inviting the rest of the team."
hint="Only visible to admins."
minRows={4}
/>
);
}

Ghost

Quiet editor field for composer surfaces.

examples/text-area-ghost.tsx
"use client";
import * as React from "react";
import { Textarea } from "@/components/wensity/text-area";
export function TextareaGhost() {
const [value, setValue] = React.useState(
"Turn this release summary into a short changelog for the customer portal.",
);
return (
<Textarea
aria-label="AI prompt"
variant="ghost"
value={value}
onChange={(event) => setValue(event.target.value)}
showCount
maxLength={180}
minRows={4}
resize="none"
/>
);
}

Error

Validation updates border, focus ring, and aria-invalid.

examples/text-area-error.tsx
import { Textarea } from "@/components/wensity/text-area";
export function TextareaError() {
return (
<Textarea
label="Reproduction steps"
defaultValue="It broke."
error="Add at least two clear steps so the team can reproduce it."
minRows={4}
/>
);
}

Character Count

Count text is connected to aria-describedby automatically.

examples/text-area-character-count.tsx
"use client";
import * as React from "react";
import { Textarea } from "@/components/wensity/text-area";
export function TextareaCharacterCount() {
const [value, setValue] = React.useState(
"A compact component library for shipping premium app interfaces faster.",
);
return (
<Textarea
label="Short bio"
value={value}
onChange={(event) => setValue(event.target.value)}
maxLength={110}
showCount
minRows={3}
resize="none"
hint="Keep it direct and useful."
/>
);
}

Read-only

Read-only values stay selectable while reducing emphasis.

examples/text-area-readonly.tsx
import { Textarea } from "@/components/wensity/text-area";
export function TextareaReadonly() {
return (
<Textarea
label="Generated summary"
value="The workspace billing role changed from Member to Admin on June 16, 2026."
readOnly
minRows={3}
resize="none"
/>
);
}

Disabled

Disabled text areas block interaction while keeping layout stable.

examples/text-area-disabled.tsx
import { Textarea } from "@/components/wensity/text-area";
export function TextareaDisabled() {
return (
<Textarea
label="Cancellation reason"
defaultValue="Workspace was archived by an organization owner."
disabled
minRows={3}
resize="none"
/>
);
}

Overview

Textarea is a React and Tailwind CSS multi-line text field, in Next.js or any React app, for comments, notes, and AI prompts. Turn on autoResize and the box grows with its content from minRows up to maxRows, then starts scrolling instead of pushing the page down. showCount prints a character counter that screen readers hear politely, and with maxLength it turns amber at 90 percent and red at the limit. Default, filled, and ghost variants cover forms and bare editors. The resize handle is hidden while autoResize is on, because the height is managed for you.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add text-area

Usage

Import TextArea from @/components/wensity/text-area and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { Textarea } from "@/components/wensity/text-area";
export function TextareaDemo() {
return (
<Textarea
label="Message"
placeholder="Describe what happened..."
hint="Include the page, action, and expected result."
/>
);
}

Props

PropTypeDefaultDescription
labelReact.ReactNode-Field label rendered above the control and wired to it for accessibility.
hintReact.ReactNode-Helper copy under the field. Hidden while error is set.
errorReact.ReactNode-Error message under the field, with invalid styling applied.
textareaSize"sm" | "md" | "lg""md"Text size and padding. Named textareaSize because size is a native attribute.
variant"default" | "filled" | "ghost""default"Surface treatment of the control.
resize"none" | "vertical" | "both""vertical"Which directions the user may drag the resize handle.
autoResizebooleanfalseGrows the field to fit its content, bounded by minRows and maxRows.
minRowsnumber4Smallest height in rows. Defaults to 3 at sm and 5 at lg.
maxRowsnumber-Largest height in rows before the field starts scrolling.
showCountbooleanfalseShows a character counter, paired with the native maxLength.
fullWidthbooleantrueStretches the field to fill its container.
  • AI Prompt Input component preview

    AI Prompt Input

    An expanding prompt area with a glowing drop zone that breathes open to meet you as you type a thought or drag a file.

  • Multi-Step Form Wizard component preview

    Multi-Step Form Wizard

    A multi-step form wizard whose card physically reshapes to wrap each new step as the content slides in behind it.

  • Animated Terminal component preview

    Animated Terminal

    A terminal UI with self-typing commands, CRT phosphor glow and scanlines, streaming output that never re-renders a line.

  • Animated Code Diff Viewer component preview

    Animated Code Diff Viewer

    Inline or toggled code diffs rendered inside the same polished code block frame, flipping between before and after.