Spaces:
3SCError404
/
Paused

dushyantsingh0
Beta 1.0: Pure Backend Release (Excluding Frontend)
5eb4857
Raw History Blame Contribute Delete
674 Bytes
import React from 'react';
import styles from './Input.module.css';
interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
label?: string;
error?: string;
className?: string;
}
export const Input: React.FC<InputProps> = ({
label,
error,
className,
id,
...props
}) => {
return (
<div className={`${styles.container} ${className || ''}`}>
{label && <label htmlFor={id} className={styles.label}>{label}</label>}
<input
id={id}
className={`${styles.input} ${error ? styles.inputError : ''}`}
{...props}
/>
{error && <span className={styles.errorText}>{error}</span>}
</div>
);
};