import { forwardRef, InputHTMLAttributes } from 'react';
import { clsx } from 'clsx';
interface InputProps extends InputHTMLAttributes {
label?: string;
error?: string;
hint?: string;
}
export const Input = forwardRef(
({ label, error, hint, className, id, ...props }, ref) => {
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, '-');
return (
{label && (
)}
{hint && !error &&
{hint}
}
{error &&
{error}
}
);
}
);
Input.displayName = 'Input';