"use client"; import { InputHTMLAttributes, forwardRef, useId } from "react"; import { cn } from "@/lib/utils"; interface TextFieldProps extends InputHTMLAttributes { label?: string; helperText?: string; errorText?: string; leadingIcon?: React.ReactNode; } export const TextField = forwardRef( ({ className, label, helperText, errorText, leadingIcon, id, ...props }, ref) => { const autoId = useId(); const inputId = id ?? autoId; const hasError = Boolean(errorText); return ( {label && ( {label} )} {leadingIcon && ( {leadingIcon} )} {errorText ? ( {errorText} ) : helperText ? ( {helperText} ) : null} ); } ); TextField.displayName = "TextField";
{errorText}
{helperText}