File tree 1 file changed +4
-2
lines changed
libs/ui-lib/lib/common/components/ui/formik
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
101
101
const fieldId = getFieldId ( props . name , 'input' , idPostfix ) ;
102
102
const isValid = ! ( touched && error ?. length ) ;
103
103
104
+ const errorMessage = isValid ? '' : error [ 0 ] ;
104
105
return (
105
106
< FormGroup
106
107
id = { `form-control__${ fieldId } ` }
@@ -163,14 +164,15 @@ const RichInputField: React.FC<RichInputFieldPropsProps> = React.forwardRef(
163
164
</ Popover >
164
165
</ InputGroupItem >
165
166
</ InputGroup >
166
- { helperText && (
167
+ { ( errorMessage || helperText ) && (
167
168
< FormHelperText >
168
169
< HelperText >
169
170
< HelperTextItem
171
+ icon = { errorMessage && < ExclamationCircleIcon /> }
170
172
variant = { isValid ? 'default' : 'error' }
171
173
id = { isValid ? `${ fieldId } -helper` : `${ fieldId } -helper-error` }
172
174
>
173
- { helperText }
175
+ { errorMessage ? errorMessage : helperText }
174
176
</ HelperTextItem >
175
177
</ HelperText >
176
178
</ FormHelperText >
You can’t perform that action at this time.
0 commit comments