Skip to content

Commit 47c0629

Browse files
authored
Merge pull request #1 from coded-bear/master
Master
2 parents dc866f1 + 9428502 commit 47c0629

28 files changed

+19525
-0
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": ["@babel/preset-env", "@babel/preset-react"],
3+
"comments": false,
4+
"compact": true
5+
}

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# dependencies
2+
node_modules/

.eslintrc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
"parser": "@babel/eslint-parser",
6+
"parserOptions": {
7+
"ecmaFeatures": {
8+
"jsx": true
9+
},
10+
"sourceType": "module"
11+
},
12+
"settings": {
13+
"react": {
14+
"version": "detect"
15+
}
16+
},
17+
"extends": [
18+
"eslint:recommended",
19+
"plugin:react/recommended",
20+
"plugin:react-hooks/recommended",
21+
"plugin:import/recommended",
22+
"plugin:prettier/recommended",
23+
"prettier"
24+
],
25+
"rules": {
26+
"no-unused-vars": "off",
27+
"react/prop-types": "off"
28+
}
29+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# dependencies
2+
/node_modules
3+
4+
# builds
5+
/lib
6+
/demo

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# dependencies
2+
/node_modules
3+
4+
# builds
5+
/lib
6+
/demo

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"arrowParens": "always",
3+
"printWidth": 120,
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "es5",
8+
"useTabs": false
9+
}

README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,111 @@
11
# react-otpinput
2+
23
Customizable OTP Input component for the web built with React.js
4+
5+
## API
6+
7+
<table>
8+
<thead>
9+
<tr>
10+
<th>Name</th>
11+
<th>Type</th>
12+
<th>Required</th>
13+
<th>Default value</th>
14+
<th>Description</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<tr>
19+
<td>value</td>
20+
<td>String</td>
21+
<td>true</td>
22+
<td>''</td>
23+
<td>The value of the OTP Input.</td>
24+
</tr>
25+
<tr>
26+
<td>onChange</td>
27+
<td>Function</td>
28+
<td>true</td>
29+
<td>console.log</td>
30+
<td>Returns OTP values typed in inputs.</td>
31+
</tr>
32+
<tr>
33+
<td>numInputs</td>
34+
<td>Number</td>
35+
<td>false</td>
36+
<td>4</td>
37+
<td>Number of inputs.</td>
38+
</tr>
39+
<tr>
40+
<td>onChangeRegex</td>
41+
<td>RegEx</td>
42+
<td>false</td>
43+
<td>none</td>
44+
<td>RegEx for single onChange.</td>
45+
</tr>
46+
<tr>
47+
<td>labelText</td>
48+
<td>String</td>
49+
<td>false</td>
50+
<td>'Enter verification code'</td>
51+
<td>Aria-label attribute for inputs.</td>
52+
</tr>
53+
<tr>
54+
<td>classNames</td>
55+
<td>String</td>
56+
<td>false</td>
57+
<td>'otp-input'</td>
58+
<td>Class names for OTP Input component.</td>
59+
</tr>
60+
<tr>
61+
<td>autoComplete</td>
62+
<td>String</td>
63+
<td>false</td>
64+
<td>'off'</td>
65+
<td>AutoComplete props for first input.</td>
66+
</tr>
67+
<tr>
68+
<td>autoFocus</td>
69+
<td>Boolean</td>
70+
<td>false</td>
71+
<td>false</td>
72+
<td>AutoFocus on first input.</td>
73+
</tr>
74+
<tr>
75+
<td>separator</td>
76+
<td>Component</td>
77+
<td>false</td>
78+
<td>none</td>
79+
<td>Separator between inputs.</td>
80+
</tr>
81+
<tr>
82+
<td>isTypeNumber</td>
83+
<td>Boolean</td>
84+
<td>false</td>
85+
<td>false</td>
86+
<td>Type number for inputs.</td>
87+
</tr>
88+
<tr>
89+
<td>hasErrored</td>
90+
<td>Boolean</td>
91+
<td>false</td>
92+
<td>false</td>
93+
<td>Error class 'otp-input--has-errored' for otp-input component.</td>
94+
</tr>
95+
<tr>
96+
<td>inputProps</td>
97+
<td>Object</td>
98+
<td>false</td>
99+
<td>none</td>
100+
<td>Props for inputs.</td>
101+
</tr>
102+
</tbody>
103+
</table>
104+
105+
## Development
106+
107+
#### Run the development server:
108+
109+
```
110+
npm run dev
111+
```

0 commit comments

Comments
 (0)