ConceptPortal-public/rsconcept/frontend/src/components/Common/TextInput.tsx
2023-07-25 20:27:29 +03:00

33 lines
749 B
TypeScript

import { type InputHTMLAttributes } from 'react';
import Label from './Label';
interface TextInputProps
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className'> {
id: string
label: string
widthClass?: string
}
function TextInput({
id, required, label, widthClass = 'w-full',
...props
}: TextInputProps) {
return (
<div className='flex flex-col items-start [&:not(:first-child)]:mt-3'>
<Label
text={label}
required={required}
htmlFor={id}
/>
<input id={id}
className={'px-3 py-2 mt-2 leading-tight border shadow dark:bg-gray-800 truncate hover:text-clip ' + widthClass}
required={required}
{...props}
/>
</div>
);
}
export default TextInput;