import React, { useEffect, useRef } from 'react'; interface TextareaProps extends React.TextareaHTMLAttributes { label?: string; error?: string; autoResize?: boolean; } const Textarea: React.FC = ({ label, error, placeholder, rows = 4, maxLength, autoResize = false, value, onChange, className = '', ...props }) => { const textareaRef = useRef(null); useEffect(() => { if (autoResize && textareaRef.current) { textareaRef.current.style.height = 'auto'; textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`; } }, [value, autoResize]); return (
{label && ( )}