import { useId } from "react"; /** * @param {Omit, "id"> & { * id?: string, * label: string, * description?: string, * error?: string * }} props */ export function TextField({ id, label, description, error, className = "", required, ...inputProps }) { const generatedId = useId(); const inputId = id ?? `field-${generatedId}`; const descriptionId = description ? `${inputId}-description` : undefined; const errorId = error ? `${inputId}-error` : undefined; const describedBy = [descriptionId, errorId].filter(Boolean).join(" "); return (
{description ? (

{description}

) : null} {error ? (

{error}

) : null}
); }