Password Toggle Custom Element

This component is a Custom Element written in pure vanilla JavaScript. It's designed to toggle the password visibility in an easy way.

Essential links

Examples

      <div class="flex items-center border-b border-b-2 border border-gray-300 rounded-lg px-4 max-w-xs">
    <input type="password" is="password-toggle" class="w-full outline-none pr-4 py-2" placeholder="Enter your password" autocomplete="new-password" />
</div>
      

Installation

This package is written with the new ES6 syntax. You can import it directly in your browser with UNPKG .

        <script type="module" defer src="https://unpkg.com/custom-element-password-toggle"></script>
      

You can also install it with npm or yarn:

        $ yarn add custom-element-password-toggle
      
        <script type="module" defer>
  import 'custom-element-password-toggle'
</script>
      

Then use it on your input fields:

        <input type="password" is="password-toggle" />