1.0.1 • Published 4 years ago

react-mobile-style-password-input v1.0.1

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

React mobile style password field

Password field with fading letters during input.

password field example

Installation

$ npm install react-mobile-style-password-input

Usage

import InputPassword from 'react-mobile-style-password-input';
<InputPassword
    onPasswordChange={handlePasswordChange}
    name='password'
    type='password'
    placeholder='Input password'
/>

You can use all native input element props in standard way, exclude change field methods. Use onPasswordChange to get value.

Style component

You can style the component with usual way, wia className or style props.

Options

You can use all native input element props in standard way, but be aware of some changes below. All props are not required.

OptionTypeDefault valueDescription
onChangefunctionA callback function to be invoked when the value of the field changes. Receives an argument containing the React SyntheticEvent object, but has an patterned string (not real password value). Use onPasswordChange instead
onPasswordChangefunctionA callback function to be invoked when the value of the field changes. Receives an value of password input (string).
patternstring'•'The letter which will be used for hiding password letters.
nameSuffixstring'__masked'Needs for generate masked (visible) password field name (value will be like name + nameSuffix)
inputRefReact.RefObjectnew React.RefObjectRef for masked (visible) password input.
typestring'password'Native type of HTMLInputElement for real (hidden) password input. Most case is use 'password' and 'text'.
namestring'password'Native name of HTMLInputElement for real (hidden) password input. Used for generate masked (visible) input name.
autoCompletebooleanundefinedNative autoComplete of HTMLInputElement for both real (hidden) and masked (visible) password inputs.
letterFadeDurationnumber600Delay before hiding inputted letter (ms).

Development and Demo

Install dependencies:

Fork the repo and then execute commands in the project folder:

$ npm install
$ npm run dev

Run the example page in your browser: /example/public/index.html

License

MIT