首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从outlineinput material ui中删除默认的可见性图标

从outlineinput material ui中删除默认的可见性图标
EN

Stack Overflow用户
提问于 2021-04-21 18:50:10
回答 1查看 43关注 0票数 0

我想从outlineinput material ui中删除默认的可见性图标。当输入类型为密码时,会显示一个默认的可见性图标。我想把它去掉。我正在使用自定义可见性图标的inputAdorment。

这是我的代码..

代码语言:javascript
复制
 <FormControl variant="outlined">
                          <InputLabel htmlFor="outlined-adornment-password">
                            What’s your current password?
                          </InputLabel>
                          <OutlinedInput
                            id="outlined-adornment-password"
                            type={showCurrentPsw ? 'text' : 'password'}
                            value={currentPassword}
                            name="currentpsw"
                            onChange={({ target: { value } }) => {
                              setCurrentPassword(value);
                              value !== '' &&
                                value.trim() !== '' &&
                                setCurrentPswdEmpty(false);
                            }}
                            error={currentPswdEmpty}
                            label="What’s your current password?"
                            required
                            endAdornment={
                              <InputAdornment position="end">
                                <IconButton
                                  aria-label="What’s your current password?"
                                  onClick={() => {
                                    setShowCurrentPsw(!showCurrentPsw);
                                  }}
                                  edge="end"
                                >
                                  {showCurrentPsw ? (
                                    <Visibility />
                                  ) : (
                                    <VisibilityOff />
                                  )}
                                </IconButton>
                              </InputAdornment>
                            }
                          />
                        </FormControl>

EN

回答 1

Stack Overflow用户

发布于 2021-04-21 19:29:30

它通过使用下面的css解决。parentclassname父元素的=>类名。这是一个react项目。

代码语言:javascript
复制
.parentclassname input[type='password']::-ms-reveal,
.parentclassname input[type='password']::-ms-clear {
  display: none;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67194368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档