{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "textarea",
  "title": "Textarea",
  "description": "Multi-line input that auto-grows, with a live character counter.",
  "dependencies": [],
  "registryDependencies": [
    "utils",
    "https://ui.cuelark.com/r/theme.json"
  ],
  "files": [
    {
      "path": "src/registry/cuelark/ui/textarea.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype TextareaProps = React.ComponentProps<\"textarea\"> & {\n  /** Grows with its content (CSS `field-sizing: content`), between `min-h` and `max-h` you set. */\n  autoGrow?: boolean;\n  /** Shows a live character count; with `maxLength` it reads `12 / 280` and warns near the limit. */\n  showCount?: boolean;\n};\n\nfunction Textarea({ className, autoGrow = false, showCount = false, maxLength, onChange, value, defaultValue, ...props }: TextareaProps) {\n  const [length, setLength] = React.useState(() => String(value ?? defaultValue ?? \"\").length);\n  const current = value !== undefined ? String(value).length : length;\n  const near = maxLength ? current / maxLength >= 0.9 : false;\n\n  const textarea = (\n    <textarea\n      data-slot=\"textarea\"\n      maxLength={maxLength}\n      value={value}\n      defaultValue={defaultValue}\n      onChange={(e) => {\n        setLength(e.target.value.length);\n        onChange?.(e);\n      }}\n      className={cn(\n        \"flex min-h-20 w-full min-w-0 rounded-md border border-input bg-card px-3 py-2 text-sm text-foreground shadow-well transition-[border-color,box-shadow] duration-150 ease-cue outline-none placeholder:text-muted-foreground/80 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20\",\n        autoGrow && \"[field-sizing:content] resize-none\",\n        showCount && \"pb-7\",\n        !showCount && className,\n      )}\n      {...props}\n    />\n  );\n\n  if (!showCount) return textarea;\n\n  return (\n    <div data-slot=\"textarea-group\" className={cn(\"relative w-full\", className)}>\n      {textarea}\n      <span\n        data-slot=\"textarea-count\"\n        aria-live=\"polite\"\n        className={cn(\"pointer-events-none absolute end-2.5 bottom-2 font-mono text-[0.6875rem] text-muted-foreground tabular-nums\", near && \"text-warning\")}\n      >\n        {current}\n        {maxLength ? ` / ${maxLength}` : \"\"}\n      </span>\n    </div>\n  );\n}\n\nexport { Textarea };\nexport type { TextareaProps };\n",
      "type": "registry:ui"
    }
  ],
  "docs": "Docs and examples: https://ui.cuelark.com/components/textarea",
  "categories": [
    "forms"
  ],
  "type": "registry:ui"
}