Files
scrap/src/app/components/Input.tsx

34 lines
818 B
TypeScript

import React from 'react';
interface InputProps {
id: string;
label: string;
value: string;
setChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
required?: boolean;
type?: string;
placeholder?: string;
}
const Input: React.FC<InputProps> = ({ id, label, value, setChange, required = false, type = "text", placeholder }) => {
return (
<div className="mb-4">
<label htmlFor={id} className="block text-sm font-medium text-gray-700">
{label}
</label>
<input
type={type}
id={id}
value={value}
onChange={setChange}
name={id}
placeholder={placeholder}
className="mt-1 p-2 block w-full border border-gray-300 rounded-md shadow-sm"
required={required}
/>
</div>
);
};
export default Input;