显示带有装饰组件的ui输入错误信息



我有下面的多个组件渲染和输入装饰。以下是示例。

<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."
/>

最新更新