0.0.9 • Published 4 years ago

@fredxd/passwordtoggle v0.0.9

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

Custom element - Password Toggle

npm

Attach toogle password behavior with this custom element.

Installation

With npm

npm i @fredxd/passwordtoggle

Or yarn

yarn add @fredxd/passwordtoggle

Usage

To attach toggle behavior to input, add is="toggle-password" to your password input

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

Attributes

You can pass some parameters via data attributes

AttributeTypeDescription
data-show-textstringText rendered in input to show password
data-hide-textstringText rendered in input to hide password
data-display-iconstring or boolYou can display icon instead of text
data-icon-showstringPath of your "show" icon (local path or url)
data-icon-hidestringPath of your "hide" icon (local path or url)

Styles

Input is encapsulate in shadow dom container. You can override some css var in order to apply your style. You can change css variable for .toggle-password-container

Css varTypeDefault valueDescription
--toggle-password-background-colorcolortransparentChange color of background for toggle element
--toggle-password-colorcolor#000Change color of text or icon
--toggle-password-widthunit40pxSet width of toggle element
--toggle-password-paddingunit5pxSet horizontal padding of toggle element
--toggle-password-icon-widthunit24pxHeight of toggle icon
--toggle-password-icon-heightunit24pxWidth of toggle icon
--toggle-password-focused-colorcolor#000Change color of text or icon when input is focused
--toggle-password-disabled-colorcolor#000Change color of text or icon when input is disabled
--toggle-password-invalid-colorcolor#000Change color of text or icon when input has class "is-invalid"
--toggle-password-filled-colorcolor#000Change color of text or icon when input is filled
0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago