Textarea

Use Textarea for notes, descriptions, or other text that can span several lines.

Preview

Investment notes and input states

Compare an editable note with a 240-character limit against explicitly invalid and disabled note fields.

Installation

New to this Registry? Complete the base setup before continuing.

npx shadcn@latest add @neumorphism-ui/textarea

Install the shared base once, then add components and their dependencies with the CLI.

Investment notes and input states

npx shadcn@latest add @neumorphism-ui/label @neumorphism-ui/textarea
Registry JSON

Usage

Connect a visible Label, set name and rows, and add constraints or supporting text for the task. Use Input for short, single-line values.

"use client";

import { useId } from "react";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";

export default function Example() {
  const id = useId();
  return (
    <div className="grid gap-2">
      <Label htmlFor={id}>Project description</Label>
      <Textarea id={id} name="description" placeholder="Describe your project" rows={4} />
    </div>
  );
}

API Reference

Forwards every native textarea attribute while styling minimum height, vertical resizing, focus, and aria-invalid states with neumorphic tokens.

ComponentPropTypeDefaultDescription
Textareavalue / defaultValuestring—The controlled text or initial uncontrolled text.
Textarearowsnumber—The initial number of visible rows.
Textareaplaceholderstring—A short example that helps communicate the expected input format.
Textareadisabled / required / readOnlybooleanfalseSets native input constraints.
Textareaaria-invalidboolean | string—Enables the error border and focus ring.

Accessibility

  • 01

    Connect Label htmlFor to the Textarea id, and do not replace Label with a placeholder.

  • 02

    When enforcing a character limit, provide maxLength and the current character count, connecting them with aria-describedby when needed.

  • 03

    Give the error message an id and connect it to the control with aria-invalid and aria-describedby.