import { type InputHTMLAttributes, forwardRef } from "react";
import clsx from "clsx";
interface FormFieldProps extends InputHTMLAttributes {
label: string;
error?: string;
hint?: string;
}
export const FormField = forwardRef(
({ label, error, hint, id, className, ...props }, ref) => {
const fieldId = id ?? props.name;
return (
{hint && !error && (
{hint}
)}
{error && (
{error}
)}
);
},
);
FormField.displayName = "FormField";