Spaces:
Sleeping
Sleeping
| import React, { forwardRef } from 'react'; | |
| interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { | |
| label?: string; | |
| error?: string; | |
| className?: string; | |
| fullWidth?: boolean; | |
| } | |
| const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>( | |
| ({ label, error, className = '', fullWidth = true, ...props }, ref) => { | |
| return ( | |
| <div className={`mb-4 ${fullWidth ? 'w-full' : ''} ${className}`}> | |
| {label && ( | |
| <label className="block text-sm font-medium mb-1 text-gray-700"> | |
| {label} | |
| </label> | |
| )} | |
| <textarea | |
| ref={ref} | |
| className={` | |
| ios-textarea | |
| ${error ? 'border-red-500' : ''} | |
| `} | |
| {...props} | |
| /> | |
| {error && <p className="mt-1 text-sm text-red-600">{error}</p>} | |
| </div> | |
| ); | |
| } | |
| ); | |
| TextArea.displayName = 'TextArea'; | |
| export default TextArea; |