1.1.0 • Published 4 years ago

react-password-strength-bar-indicator v1.1.0

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

react-password-strength-bar-indicator

Overview

A simple npm package to implement password input with strength bar indicator to know the password strength.

Installation

Npm users

$ npm install --save react-password-strength-bar-indicator

Yarn users

$ yarn add react-password-strength-bar-indicator

Usage

For Stateful components.

import  PasswordInput  from  'react-password-strength-bar-indicator';
import  "react-password-strength-bar-indicator/lib/main.css"

class App extends React.Component {
...
    this.state = {
	    password: '',
	    passwordStrength: '', // To get the values of strenght
	}
	render(){
		return(
			<PasswordInput
				value={this.state.password}
				onChange={e => this.setState({password: e.target.value})
				passwordStrength={value => this.setState({passwordStrength: value})
				placeholder="Password"
				type="password"
			/>
		)
	}
}

For Stateless component.

import  PasswordInput  from  'react-password-strength-bar-indicator';
import  "react-password-strength-bar-indicator/lib/main.css"

const App = () => {
    const [password, setPassword] = useState("");
    const [passwordStrength, setPasswordStrength] = useState("");
	
	return(
		<PasswordInput
			value={password}
			onChange={e => setPassword(e.target.value)
			passwordStrength={value => setPasswordStrength(value)
			placeholder="Password"
			type="password"
		/>
	)
}

Props

PropsValueDescription
valueinput valueInput value
onChangeonChange={e => func(e)}to handle onchange password input
inputClassNameinputClasNameTo change the style for password input which takes className as a value
placeholderplaceholderFor password input placeholder
disableddisabled={false}To disable the password input either true or false
statusClassNamestatusClassNameTo change the style for status which is weak , fair and strong which takes className as a value
passwordStrengthpasswordStrength={value => func(value)}PasswordStrength function which will return the current strength of password
strengthStylestrengthStyle={{style}}StrengthStyle takes React style object to style the bar indicator.
typetypeType which can be either password or text field.

License

MIT

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago