41 lines
969 B
React
41 lines
969 B
React
import React from 'react'
|
|
|
|
export default function Textarea({
|
|
label,
|
|
placeholder = '',
|
|
value,
|
|
onChange,
|
|
error,
|
|
disabled = false,
|
|
rows = 4,
|
|
className = '',
|
|
...props
|
|
}) {
|
|
return (
|
|
<div className={`w-full ${className}`}>
|
|
{label && (
|
|
<label className="block text-sm font-bold mb-2">
|
|
{label}
|
|
</label>
|
|
)}
|
|
<textarea
|
|
value={value}
|
|
onChange={onChange}
|
|
disabled={disabled}
|
|
placeholder={placeholder}
|
|
rows={rows}
|
|
className={`w-full px-3 py-2 border-2 border-black bg-white
|
|
focus:outline-none focus:ring-2 focus:ring-brutal-yellow
|
|
placeholder:text-black/40 resize-y
|
|
${disabled ? 'opacity-50 cursor-not-allowed' : ''}
|
|
${error ? 'border-red-500 focus:ring-red-500' : ''}
|
|
`}
|
|
{...props}
|
|
/>
|
|
{error && (
|
|
<p className="mt-1 text-sm text-red-600 font-medium">{error}</p>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|