mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 21:10:38 +03:00
39 lines
880 B
TypeScript
39 lines
880 B
TypeScript
import { TextareaHTMLAttributes } from 'react';
|
|
|
|
import Label from './Label';
|
|
|
|
export interface TextAreaProps
|
|
extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'className' | 'title'> {
|
|
label?: string
|
|
tooltip?: string
|
|
dimensions?: string
|
|
colorClass?: string
|
|
}
|
|
|
|
function TextArea({
|
|
id, label, required, tooltip,
|
|
dimensions = 'w-full',
|
|
colorClass = 'clr-input',
|
|
rows = 4,
|
|
...props
|
|
}: TextAreaProps) {
|
|
return (
|
|
<div className='flex flex-col items-start gap-2'>
|
|
{label && <Label
|
|
text={label}
|
|
required={!props.disabled && required}
|
|
htmlFor={id}
|
|
/>}
|
|
<textarea id={id}
|
|
title={tooltip}
|
|
className={`px-3 py-2 leading-tight border shadow clr-outline ${colorClass} ${dimensions}`}
|
|
rows={rows}
|
|
required={required}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default TextArea;
|