Skip to content
This repository was archived by the owner on Nov 3, 2024. It is now read-only.

Commit 4321f21

Browse files
authored
Merge pull request #26 from drac94/update-readme-2-0
Update version and readme
2 parents 2533315 + bd5ea0e commit 4321f21

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

README.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# React Auth Code Input
44

5-
> A React Component for inputting Auth Codes inspired in Apple Two-Factor Authentication UI. It allows deleting using the backspace and pasting as well.
5+
> A React Component for inputting Auth Codes inspired in Apple Two-Factor Authentication UI. You can type, paste and move backwards using the backspace.
66
77
[![NPM](https://img.shields.io/npm/v/react-auth-code-input.svg)](https://www.npmjs.com/package/react-auth-code-input) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
88
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
@@ -29,14 +29,19 @@ yarn add react-auth-code-input
2929
## Usage
3030

3131
```jsx
32-
import React from 'react';
32+
import React, { useState } from 'react';
3333
import AuthCode from 'react-auth-code-input';
3434

3535
const App = () => {
36+
const [result, setResult] = useState('');
37+
const handleOnChange = (res: string) => {
38+
setResult(res);
39+
};
40+
3641
return (
3742
<AuthCode
3843
characters={5}
39-
onChange={() => null}
44+
onChange={handleOnChange}
4045
containerClassName='container'
4146
inputClassName='input'
4247
/>
@@ -48,20 +53,27 @@ const App = () => {
4853

4954
| Prop | Type | Description | Default Value | Observations |
5055
| :------------------- | :---------------------- | :------------------------------------------------------------------------------ | :------------- | :----------------------------- |
51-
| `characters` | Number | The number of inputs to display | 6 | |
5256
| `allowedCharacters` | String | Regex for allowed characters | `^[A-Za-z0-9]` | |
53-
| `password` | Boolean | If present changes the type of the input to password, by default is set to text | False | |
54-
| `inputStyle` | Object | The styles to be applied to each input | | deprecated since version 1.2.0 |
55-
| `containerStyle` | Object | The styles to be applied to the container | | deprecated since version 1.2.0 |
56-
| `inputClassName` | String | The styles to be applied to each input | | |
57+
| `characters` | Number | The number of inputs to display | 6 | |
5758
| `containerClassName` | String | The styles to be applied to the container | | |
59+
| `inputClassName` | String | The styles to be applied to each input | | |
60+
| `inputType` | String | The type of the inputs | text | text, number or password |
5861
| `onChange` | Function(value: String) | Callback function called every time an input value changes | | |
62+
| ~~`password`~~ | Boolean | If present changes the type of the input to password, by default is set to text | false | deprecated since version 2.0.0 |
63+
| ~~`inputStyle`~~ | Object | The styles to be applied to each input | | deprecated since version 1.2.0 |
64+
| ~~`containerStyle`~~ | Object | The styles to be applied to the container | | deprecated since version 1.2.0 |
5965

6066
## Changelog
6167

68+
### 2.0.0
69+
70+
- Remove `inputStyle` prop in favor of `inputClassName`.
71+
- Remove `containerStyle` prop in favor of `containerClassName`.
72+
- Remove `password` prop in favor of `inputType` which accepts _text_, _password_ or _number_ value.
73+
6274
### 1.2.1
6375

64-
- Add missing dist files
76+
- Add missing dist files.
6577

6678
### 1.2.0
6779

0 commit comments

Comments
 (0)