[英]Disable floating top left label animation material-ui password input ReactJS
i found an exisitng input with a hide/show password icon, but the probleme is that floating label since iam using material ui and i didn't find a way to remove that animation and make it look like a simple input text with a placeholder我找到了一个带有隐藏/显示密码图标的现有输入,但问题是浮动标签,因为我正在使用材质 ui,我没有找到删除该动画并使其看起来像带有占位符的简单输入文本的方法
this is my code :这是我的代码:
<Box sx={{ display: "flex", flexWrap: "wrap" }}>
<div>
<FormControl sx={{ m: 1, width: "25ch" }} variant="outlined">
<InputLabel >
Type here...
</InputLabel>
<OutlinedInput
id="outlined-adornment-password"
type={values.showPassword ? "text" : "password"}
value={values.password}
onChange={handleChange("password")}
endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={handleClickShowPassword}
onMouseDown={handleMouseDownPassword}
edge="end"
>
{values.showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
}
label="Password"
/>
</FormControl>
</div>
</Box>
it looks like this when i click on the input so i wanna remove that floating effect and make it looks normal当我点击输入时它看起来像这样所以我想删除那个浮动效果并让它看起来很正常
when using shrink={true}使用收缩={true} 时
You need to add shrink={true}
to InputLabel
to remove the label floating effect.您需要在
InputLabel
中添加shrink={true}
以消除标签浮动效果。
<InputLabel shrink={true}>
Type here...
</InputLabel>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.