Wensity Labs

Text Area

Forms

About

An auto resizing textarea with live character count, validation states and variants for notes, comments and AI prompts. Accessible and fully styled with Tailwind.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Text Area to your project and fits it to your theme.

Code

How Text Area is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { Textarea } from "@/components/ui/text-area";

import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs));
}

const primitivePreviewCardSurfaceFrameClass = cn(
  "relative isolate overflow-hidden rounded-2xl",
  "border",
);

const primitivePreviewCardSurfaceLightClass = cn(
  "border-black/[0.08] bg-[#f4f4f5]",
  "[box-shadow:0_1px_2px_rgba(0,0,0,.06),0_8px_24px_-12px_rgba(0,0,0,.08)]",
);

const primitivePreviewCardSurfaceClass = cn(
  primitivePreviewCardSurfaceFrameClass,
  primitivePreviewCardSurfaceLightClass,
  // Full static `dark:bg-[#0a0a0b]` kept for Tailwind content scan - same as
  // PRIMITIVE_PREVIEW_CANVAS_DARK_BG / PRIMITIVE_PREVIEW_CANVAS_DARK.
  "dark:border-white/[0.06] dark:bg-[#0a0a0b] dark:[box-shadow:0_1px_2px_rgba(0,0,0,.4),0_8px_24px_-12px_rgba(0,0,0,.6)]",
);

const wensityCardSurfaceClass = primitivePreviewCardSurfaceClass;

function PreviewPanel({
  children,
  className,
}: {
  children: React.ReactNode;
  className?: string;
}) {
  return (
    <div
      className={cn(
        wensityCardSurfaceClass,
        "w-full max-w-md p-6",
        className,
      )}
    >
      {children}
    </div>
  );
}

export function TextareaPreview() {
  return (
    <PreviewPanel>
      <Textarea
        label="Message"
        placeholder="Thanks for the report. I checked the workspace and..."
        defaultValue="Thanks for the report. I checked the workspace and found the import failed because two rows are missing email addresses."
        minRows={4}
        maxRows={7}
        autoResize
      />
    </PreviewPanel>
  );
}

export default function Demo() {
  return <TextareaPreview />;
}

Dependencies

More by Wensity Labs

View all
  • Sidebar

    Sidebar

    226
  • Calendar

    Calendar

    169
  • Button

    Button

    74
  • Color Picker

    Color Picker

    62
  • Image Comparison Slider

    Image Comparison Slider

    54
  • AI Prompt Input

    AI Prompt Input

    49
  • Navigation Menu

    Navigation Menu

    36
  • Text Morphing

    Text Morphing

    35

More in Forms

View all
  • Premium Auth

    Premium Auth

    496
  • Authentication Card

    Authentication Card

    44
  • Login 1

    Login 1

    52
  • Login 2

    Login 2

    7
  • Form

    Form

    32
  • Card Studio

    Card Studio

    41
  • Login Card

    Login Card

    32
  • Form

    Form

    136