File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1
1
# react-otp-field
2
2
3
+ [ ![ npm version] ( https://img.shields.io/npm/v/react-otp-field )] ( https://www.npmjs.com/package/react-otp-field ) [ ![ npm] ( https://img.shields.io/npm/l/react-otp-field )] ( https://github.com/coded-bear/react-otp-field/blob/main/LICENSE ) [ ![ npm] ( https://img.shields.io/bundlephobia/minzip/react-otp-field )] ( https://www.npmjs.com/package/react-otp-field )
4
+
3
5
Customizable OTP Field component for the web built with React.js
4
6
7
+ [ Live Demo] ( https://coded-bear.github.io/react-otp-field/ )
8
+
9
+ ## Installation
10
+
11
+ ```
12
+ npm install --save react-otp-field
13
+ ```
14
+
15
+ ## Basic usage
16
+
17
+ ``` jsx
18
+ import React , { useState } from ' react' ;
19
+ import OtpField from ' react-otp-field' ;
20
+
21
+ const App = () => {
22
+ const [value , setValue ] = useState (' ' );
23
+
24
+ return (
25
+ < OtpField
26
+ value= {value}
27
+ onChange= {setValue}
28
+ numInputs= {6 }
29
+ onChangeRegex= {/ ^ ([0-9 ] {0,} )$ / }
30
+ autoFocus
31
+ separator= {< span> - < / span> }
32
+ isTypeNumber
33
+ inputProps= {{ className: ' otp-field__input' , disabled: false }}
34
+ / >
35
+ );
36
+ };
37
+ ```
38
+
5
39
## API
6
40
7
41
<table >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-otp-field" ,
3
- "version" : " 2.0 .0" ,
3
+ "version" : " 2.1 .0" ,
4
4
"description" : " Customizable OTP Field component for the web built with React.js" ,
5
5
"main" : " lib/index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments