Textarea

The multi-line twin of Input.

Install

$ npx shadcn@latest add @nudgekit/textarea

Or with no config: npx shadcn@latest add https://ui.nudgekit.app/r/textarea.json

Usage

usage.tsx
import { Textarea } from "@/components/ui/textarea"

<Textarea placeholder="Describe what the capture should show" />

Do

  • Put it inside a Field with a label.

Don't

  • Use it for single-line values.

Code

What the CLI writes into your project. It is yours to change.

components/ui/textarea.tsx
import * as React from "react";

import { cn } from "@/lib/utils";

function Textarea({ className, ...props }: React.TextareaHTMLAttributes<HTMLTextAreaElement>) {
  return (
    <textarea
      data-slot="textarea"
      className={cn(
        "min-h-24 w-full rounded-md border border-input bg-background px-3 py-2.5 text-[15px] leading-relaxed text-foreground transition-[border-color,box-shadow] duration-150",
        "placeholder:text-faint focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-brand-tint",
        "aria-invalid:border-danger disabled:cursor-not-allowed disabled:bg-surface disabled:opacity-60",
        className,
      )}
      {...props}
    />
  );
}

export { Textarea };