我有下面的多个组件渲染和输入装饰。以下是示例。
<FormControl fullWidth sx={{ m: 1 }} variant="standard">
<InputLabel htmlFor="standard-adornment-amount">
Paid Fees
</InputLabel>
<Input
{...field}
name="paidFees"
id="standard-adornment-amount"
error={Boolean(errors["paidFees"])}
startAdornment={
<InputAdornment position="start">₹</InputAdornment>
}
/>
</FormControl>
从输入API,它接受properror
,但没有prop传递helperText
来显示错误消息。
也许你可以改变使用TextField而不是输入。下面是TextField代码示例,您可以尝试一下。
<TextField
error
id="outlined-error-helper-text"
label="Paid Fees"
helperText="Incorrect fees."
/>