Docs
Textarea Input
Textarea Input

A flexible textarea component with multiple size options, validation, variants, and Zod integration for multi-line text input.

Share your thoughts with us

Overview

The Textarea Input component delivers an intuitive multi-line text entry experience with flexible sizing, validation, and styling options, essential for longer content input like comments, descriptions, and messages. It features three size variants (small, medium, large), both default and pill styling, and comprehensive validation support. Perfect for feedback forms, content creation, and any scenario requiring extended text input with excellent user experience.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/textarea-input.json

Usage

"use client"
 
import { TextareaInput } from "@/registry/inputs/textarea-input"
 
export function Component() {
  return (
    <TextareaInput
      label="Message"
      name="message"
      placeholder="Enter your message..."
      description="Share your thoughts or feedback"
      size="md"
      required
      onChange={(e) => console.log("Content:", e.target.value)}
    />
  )
}

API Reference

Props

PropTypeDefaultDescription
labelstring-Label for the textarea field (required)
namestring-Name of the textarea field for form submission (required)
descriptionstringundefinedDescription text below the label
hintstringundefinedHint text below the textarea
errorstringundefinedError message to display
requiredbooleanfalseWhether the field is required
pendingbooleanfalseWhether the field is in a loading state
defaultValuestringundefinedDefault value for the textarea
disabledbooleanfalseWhether the textarea is disabled
idstringnameID for the textarea element
placeholderstringundefinedPlaceholder text
variant"default" | "pill""default"Visual variant of the textarea
size"sm" | "md" | "lg""md"Size variant that adjusts height based on expected input length
coloredBorderbooleanfalseWhether to show colored border (pill variant)
labelVariant"default" | "muted""default"Label text styling variant
containerClassNamestring""CSS classes for the container
labelClassNamestring""CSS classes for the label
schemaZodType<string>undefinedZod schema for validation
onValidate(isValid: boolean, value: string, error?: string) => voidundefinedValidation callback
showActiveCountbooleanfalseWhether to show active character count (e.g., "432/500")

All standard HTML textarea attributes are also supported and passed through to the underlying textarea element.

Size Guidelines

The size prop adjusts the textarea height to accommodate different expected input lengths:

  • sm (Small): 3 rows - Perfect for short text like names, titles, or brief comments
  • md (Medium): 4 rows - Ideal for moderate content like descriptions, feedback, or messages
  • lg (Large): 6 rows - Best for longer content like detailed descriptions, reviews, or extensive comments

Choose the size based on the typical content length you expect users to enter. This helps create an appropriate visual affordance and reduces the need for manual resizing.

Examples

Pill Variant

Rounded pill variant with muted background styling for modern interfaces.

Pill variant with colored border

Max Length Example

Textarea with character limits and active character count display. The showActiveCount prop displays the current character count in "432/500" format, providing clear feedback to users about their input length.

496/500 characters