Skip to content

Commit ec9b373

Browse files
authored
Merge pull request #7 from coded-bear/master
Master
2 parents 41184b9 + d6e286e commit ec9b373

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
11
# react-otp-field
22

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+
35
Customizable OTP Field component for the web built with React.js
46

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+
539
## API
640

741
<table>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-otp-field",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "Customizable OTP Field component for the web built with React.js",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)