PlutoUI.jl icon indicating copy to clipboard operation
PlutoUI.jl copied to clipboard

[Suggestion] Support hide/show toggle on password element

Open rapus95 opened this issue 4 years ago • 2 comments

As seen in there: image image

Example taken from: https://lastpass.com/?ac=1&lpnorefresh=1

rapus95 avatar Jun 18 '21 13:06 rapus95

Can you elaborate a bit further? What is the proposed API? What is the use case? Do you need notebooks with Username/password inputs? Why is not enough?

pankgeorg avatar Jun 20 '21 12:06 pankgeorg

itmshowpw = @bind showpw CheckBox()
##next cell
if showpw
	itmserverpassword = @bind serverpassword TextField(default=elem.password)
else
	itmserverpassword = @bind serverpassword PasswordField(default=elem.password)
end
##next cell
elem.password = serverpassword

Currently I need to use three cells in order to implement the same functionality on whether the password field shows plaintext or hidden text. But that could be moved into the javascript side of the UI-element. The API would just get another two keyword arguments

  • visibilitytoggle defaulting to true which enables using the toggle and
  • plaintext which defaults to false and is the initial state of the toggle

rapus95 avatar Jun 20 '21 13:06 rapus95