ConceptPortal-public/rsconcept/frontend/src/components/Common/TextArea.tsx

45 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
import Label from './Label';
interface TextAreaProps {
id: string
label: string
required?: boolean
disabled?: boolean
2023-07-20 17:11:03 +03:00
spellCheck?: boolean
2023-07-15 17:46:19 +03:00
placeholder?: string
widthClass?: string
rows?: number
value?: any
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void
2023-07-20 17:11:03 +03:00
onFocus?: () => void
2023-07-15 17:46:19 +03:00
}
2023-07-20 17:11:03 +03:00
function TextArea({
id, label, placeholder,
required, spellCheck, disabled,
widthClass='w-full', rows=4, value,
onChange, onFocus
}: TextAreaProps) {
2023-07-15 17:46:19 +03:00
return (
<div className='flex flex-col items-start [&:not(:first-child)]:mt-3'>
<Label
text={label}
required={required}
htmlFor={id}
/>
2023-07-20 17:11:03 +03:00
<textarea id={id}
2023-07-15 17:46:19 +03:00
className={'px-3 py-2 mt-2 leading-tight border shadow dark:bg-gray-800 '+ widthClass}
rows={rows}
placeholder={placeholder}
required={required}
value={value}
onChange={onChange}
2023-07-20 17:11:03 +03:00
onFocus={onFocus}
2023-07-15 17:46:19 +03:00
disabled={disabled}
2023-07-20 17:11:03 +03:00
spellCheck={spellCheck}
2023-07-15 17:46:19 +03:00
/>
</div>
);
}
export default TextArea;