1.0.17 • Published 3 years ago

react-senha-checklist v1.0.17

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

React Senha Checklist

NPM

npm version NPM License

Um componente React para exibir o sucesso ou a falha das regras de força da senha que são atualizadas conforme o usuário digita.

Example

Exemplo

Install in your project

npm install --save react-senha-checklist

yarn add react-senha-checklist

Note: react is a peer dependency. You should be using this in a React project.

Example Usage

import React, {useState} from "react"
import PasswordChecklist from "react-senha-checklist"

const SignUp = () => {
	const [password, setPassword] = useState("")
	const [passwordAgain, setPasswordAgain] = useState("")
	return (
		<form>
			<label>Password:</label>
			<input type="password" onChange={e => setPassword(e.target.value)}>
			<label>Password Again:</label>
			<input type="password" onChange={e => setPasswordAgain(e.target.value)}>

			<PasswordChecklist
				rules={["length","specialChar","number","capital","match"]}
				minLength={5}
				value={password}
				valueAgain={passwordAgain}
				onChange={(isValid) => {}}
			/>
		</form>
	)
}

Available Rules

Customize the component to display only the rules you need in the desired order you wish to display them.

length

Valid if the password meets the minimum length. Requires minLength prop to be included.

specialChar

Valid if the password contains a special character from ~!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?.

number

Valid if the password contains a number.

capital

Valid if the password contains a capital letter.

match

Valid if the password matches the confirm password valud. Requires valueAgain prop to be included.

Props

PropDescriptionTypeRequiredDefault
rulesRules to display in the order desired.Options are length, specialChar,number, capital, matcharrayyes
valueCurrent potential passwordstringyes
minLengthMinimum Password LengthnumberOnly withlength rule
valueAgainCurrent potential password confirmationstringOnly withmatch rule
onChangeCallback that is triggered when thepassword becomes valid or invalid acrossall rules.function(isValid) => {}
classNameClass applied to the entire componentstring
styleInline styles applied to theouter component wrapperobject
iconSizeSize of ✔ or 𐄂 iconnumber18
validColorColor of checkmark iconstring#4BCA81
invalidColorColor of X iconstring#FF0033

Available Classes

  • .valid - Valid Message
  • .invalid - Invalid Message

Run Locally

npm run storybook

yarn storybook

1.0.17

3 years ago

1.0.16

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago