27 lines
685 B
TypeScript
27 lines
685 B
TypeScript
import { type InputHTMLAttributes } from "react";
|
|
|
|
type TextInputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
label: string;
|
|
required?: boolean;
|
|
error?: string;
|
|
};
|
|
|
|
export default function TextInput({
|
|
label,
|
|
required,
|
|
error,
|
|
className = "",
|
|
...props
|
|
}: Readonly<TextInputProps>) {
|
|
return (
|
|
<input
|
|
{...props}
|
|
placeholder={`${label}${required ? "*" : ""}`}
|
|
required={required}
|
|
className={`w-full rounded-full border-4 lowercase placeholder:uppercase bg-white px-6 py-4 font-poppins-bold text-body text-bleu outline-none placeholder:text-bleu
|
|
${className}
|
|
${error ? "border-rouge" : "border-bleu"}
|
|
`}
|
|
/>
|
|
);
|
|
}
|