import React, { useId } from 'react'; import clsx from 'clsx'; export interface InputProps extends React.InputHTMLAttributes { label?: string; error?: string; helperText?: string; required?: boolean; } export const Input = React.forwardRef( ({ label, error, helperText, required, className, id, ...props }, ref) => { const generatedId = useId(); const inputId = id || generatedId; const errorId = `${inputId}-error`; const helperId = `${inputId}-helper`; return (
{label && ( )} {error && ( )} {helperText && !error && (

{helperText}

)}
); } ); Input.displayName = 'Input';