Skip to content

Commit

Permalink
Fix reserve spacing for error message in Joy
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbrando committed Jul 22, 2024
1 parent f2c1e95 commit 55d73c7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ export const FormControlWrapper = (props: FormControlWrapperProps) => {

const { effectiveReserveSpaceForValidationMessage } = useJoyFormUtils(reserveSpaceForValidationMessage);

const showErrorMessage = hasValue(errorMessage) || effectiveReserveSpaceForValidationMessage;

return (
<FormControl size={size} error={hasValue(errorMessage)} required={isRequired} disabled={isDisabled}>
{hasValue(label) && <FormLabel>{label}</FormLabel>}
{children}
<FormHelperText>{errorMessage ?? (effectiveReserveSpaceForValidationMessage ? <>{"\u00A0"}</> : null)}</FormHelperText>
{showErrorMessage && <FormHelperText>{errorMessage ?? (effectiveReserveSpaceForValidationMessage ? <>{"\u00A0"}</> : null)}</FormHelperText>}
</FormControl>
);
};

0 comments on commit 55d73c7

Please sign in to comment.