diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index 6f5640037f..36208630b3 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -102,6 +102,7 @@ const AutocompleteInput: FunctionComponent< format, fullWidth, helperText, + disableHelperText, id: idOverride, input: inputOverride, isRequired: isRequiredOverride, @@ -390,11 +391,13 @@ const AutocompleteInput: FunctionComponent< htmlFor: id, })} helperText={ - + disableHelperText ? null : ( + + ) } variant={variant} margin={margin} diff --git a/packages/ra-ui-materialui/src/input/SearchInput.tsx b/packages/ra-ui-materialui/src/input/SearchInput.tsx index bac28b5d0d..200610c492 100644 --- a/packages/ra-ui-materialui/src/input/SearchInput.tsx +++ b/packages/ra-ui-materialui/src/input/SearchInput.tsx @@ -27,6 +27,7 @@ const SearchInput: FunctionComponent< hiddenLabel label="" resettable + disableHelperText={true} placeholder={translate('ra.action.search')} InputProps={{ endAdornment: ( diff --git a/packages/ra-ui-materialui/src/input/SelectInput.tsx b/packages/ra-ui-materialui/src/input/SelectInput.tsx index beeed24a09..c1a0ef8f94 100644 --- a/packages/ra-ui-materialui/src/input/SelectInput.tsx +++ b/packages/ra-ui-materialui/src/input/SelectInput.tsx @@ -154,6 +154,7 @@ const SelectInput: FunctionComponent< emptyValue, format, helperText, + disableHelperText, label, onBlur, onChange, @@ -223,11 +224,13 @@ const SelectInput: FunctionComponent< clearAlwaysVisible error={!!(touched && error)} helperText={ - + disableHelperText ? null : ( + + ) } {...options} {...sanitizeRestProps(rest)} @@ -274,6 +277,7 @@ SelectInput.propTypes = { resource: PropTypes.string, source: PropTypes.string, translateChoice: PropTypes.bool, + disableHelperText: PropTypes.bool, }; SelectInput.defaultProps = { @@ -285,6 +289,7 @@ SelectInput.defaultProps = { optionValue: 'id', translateChoice: true, disableValue: 'disabled', + disableHelperText: false, }; export default SelectInput; diff --git a/packages/ra-ui-materialui/src/input/TextInput.tsx b/packages/ra-ui-materialui/src/input/TextInput.tsx index 6b695b8fa7..c8a5ce4da8 100644 --- a/packages/ra-ui-materialui/src/input/TextInput.tsx +++ b/packages/ra-ui-materialui/src/input/TextInput.tsx @@ -28,6 +28,7 @@ const TextInput: FunctionComponent = ({ label, format, helperText, + disableHelperText, onBlur, onFocus, onChange, @@ -73,11 +74,13 @@ const TextInput: FunctionComponent = ({ } error={!!(touched && error)} helperText={ - + disableHelperText ? null : ( + + ) } {...options} {...sanitizeRestProps(rest)} @@ -91,10 +94,12 @@ TextInput.propTypes = { options: PropTypes.object, resource: PropTypes.string, source: PropTypes.string, + disableHelperText: PropTypes.bool, }; TextInput.defaultProps = { options: {}, + disableHelperText: false, }; export default TextInput;