Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: password masking visibility toggle #107

Closed
mirshko opened this issue Sep 11, 2019 · 1 comment
Closed

Suggestion: password masking visibility toggle #107

mirshko opened this issue Sep 11, 2019 · 1 comment

Comments

@mirshko
Copy link

mirshko commented Sep 11, 2019

Loving the package so far! Just wondering if there was some way there could be a built in function for the password field to toggle the visibility of the password. It seems the easiest way to do it would be use a text input and then toggle the type manually via a prop, but it might be nice to just have a function on the password type to toggle it in the API.

It seems password toggles are better for UX and it would be nice to have it all built into this awesome package.

@mirshko mirshko changed the title Suggestion: password type toggle visible Suggestion: password masking visibility toggle Sep 11, 2019
@wsmd
Copy link
Owner

wsmd commented Sep 26, 2019

Hi @mirshko - this seems to be outside the scope of this library as it's only intended to help with managing the form state, not necessarily how they look. There's probably a way to achieve this perhaps using .raw().

function MaskedPassword(props) {
  return (
    // MaskedPassword implementation
  )
}

function MyForm() {
  const [formState, { raw }] = useFormState({ password: '' });
  return (
    <>
      <MaskedPassword {...raw('password')} />
    </>
  )
}

I suggest taking a look at the Custom Controls section of the documentation for more information.

@wsmd wsmd closed this as completed Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants