-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Password peek-a-boo #314
Comments
Proposed steps @olavea:
|
The thing is not showing up, but I don't think the warning below solves it. I will keep working. Warning: React does not recognize the |
an ordinary terniary? {values.showPassword ? <VisibilityOff /> : <Visibility />} Q A const [values, setValues] = React.useState({
....
showPassword: false,
}); Q A import Visibility from "@mui/icons-material/Visibility"
import VisibilityOff from "@mui/icons-material/VisibilityOff" Over is printed out Q <IconButton
aria-label="toggle password visibility"
onClick={handleClickShowPassword}
edge="end"
>
{values.showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton> A Q <IconButton
....
onClick={handleClickShowPassword}
....
>
// {values.showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton> A const [values, setValues] = React.useState({
....,
showPassword: false,
}); after spreading in the values </FormControl>
<FormControl sx={{ m: 1, width: '25ch' }} variant="outlined">
<InputLabel htmlFor="outlined-adornment-password">Password</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> import import InputAdornment from "@mui/material/InputAdornment"
import IconButton from "@mui/material/IconButton"
import Visibility from "@mui/icons-material/Visibility"
import VisibilityOff from "@mui/icons-material/VisibilityOff" values? endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="toggle password visibility"
onClick={handleClickShowPassword}
edge="end"
>
{values.showPassword ? <VisibilityOff /> : <Visibility />}
</IconButton>
</InputAdornment>
}
get userbase up and running Wait with: const handleMouseDownPassword = (event) => {
event.preventDefault();
};
....
<OutlinedInput
....
value={values.password}
onChange={handleChange('password')}
....
onMouseDown={handleMouseDownPassword} |
Add an eye icon to password fields so that the user can view the password they have entered.
Check out example here: https://material-ui.com/components/text-fields/#input-adornments
The text was updated successfully, but these errors were encountered: