【发布时间】:2020-06-08 13:46:21
【问题描述】:
我想使用 TextField 的轮廓样式,其标签必须包含带有一些文字的 tooltip 图标
现场演示请参考Sandbox
代码摘录:
const IconWithTooltip = () => (
<Tooltip title="Text explaining stuff">
<HelpIcon />
</Tooltip>
);
const Example = () => {
return (
<div>
<FormControl variant="outlined">
<InputLabel htmlFor="with-label">
FormControl with label
<IconWithTooltip />
</InputLabel>
<OutlinedInput
id="with-label"
startAdornment={<InputAdornment position="start">$</InputAdornment>}
/>
</FormControl>
<TextField
label={
<div>
TextFiled
<IconWithTooltip />
</div>
}
variant="outlined"
/>
Just icon with tooltop
<IconWithTooltip />
</div>
);
};
问题: 将鼠标悬停在 (?) 图标上时不会出现工具提示。我尝试使用 FormControl 和 TextInput 以 2 种不同的方式对输入进行编码,但没有一个有效。我错过了什么吗?
【问题讨论】:
-
您的问题在于 .MuiInputLabel-outlined 类中的“指针事件:无”CSS。根据您的需要更新它,它应该可以工作。
标签: reactjs material-ui