Skip to content

Commit f1d1e9d

Browse files
committed
chore: update README.md
1 parent d62bd82 commit f1d1e9d

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

README.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# react-input-verification-code
22

3-
A verification code input, autocompletion friendly
3+
A verification code input, mobile autocompletion friendly
44

55
[![NPM](https://img.shields.io/npm/v/react-input-verification-code.svg)](https://www.npmjs.com/package/react-input-verification-code) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
66

77
## Features
88

99
- Support native autocompletion when receiving a code via SMS
10-
- Support pasted string (when number)
10+
- Support pasted string
1111

1212
## Examples
1313

@@ -20,54 +20,55 @@ A verification code input, autocompletion friendly
2020
```
2121
{
2222
"react": ">=16.0.0",
23-
"styled-components": ">=5.0.0"
23+
"react-dom": ">=16.0.0"
2424
}
2525
```
2626

2727
## Install
2828

2929
```bash
3030
yarn add react-input-verification-code
31-
32-
# if you don't use `styled-components` in your project
33-
# you have to install it as well
34-
yarn add react-input-verification-code styled-components
3531
```
3632

3733
## Usage
3834

3935
```tsx
40-
import * as React from 'react';
41-
import ReactInputVerificationCode from 'react-input-verification-code';
36+
import React from 'react';
37+
import ReactInputVerificationCode, {
38+
ReactInputVerificationCodeProps,
39+
} from 'react-input-verification-code';
40+
41+
const customProps: ReactInputVerificationCodeProps = {
42+
autoFocus: true,
43+
};
4244

4345
export default function App() {
44-
return <ReactInputVerificationCode />;
46+
return <ReactInputVerificationCode {...customProps} />;
4547
}
4648
```
4749

4850
## API
4951

5052
### Props
5153

52-
| Key | Type | Default | Required | Description |
53-
| ----------- | -------------------- | ---------- | -------- | --------------------------------------------------------- |
54-
| autoFocus | `boolean` | false | false | Focus on render |
55-
| length | `number` | `4` | false | How many items will be rendered |
56-
| onChange | `function` | `() => {}` | false | Function called when the value changes |
57-
| onCompleted | `function` | `() => {}` | false | Function called when the code is completed |
58-
| placeholder | `string` | `·` | false | String rendered in each item when no value has been typed |
59-
| value | `string` | `() => {}` | false | Control internal input value |
60-
| type | `text` or `password` | `text` | false | Display the item value or a password mask |
61-
62-
### CSS Properties
63-
64-
The following CSS properties are set globally so you can easily override them to fit your needs
65-
66-
| Key | Default | Description |
67-
| ------------------------------------------ | -------- | ----------------------- |
68-
| `--ReactInputVerificationCode-itemWidth` | `4.5rem` | Width of an item |
69-
| `--ReactInputVerificationCode-itemHeight` | `5rem` | Height of an item |
70-
| `--ReactInputVerificationCode-itemSpacing` | `1rem` | Space between two items |
54+
| Key | Type | Default | Required | Description |
55+
| ----------- | ------------------------ | ------------ | -------- | -------------------------------------------------- |
56+
| autoFocus | `boolean` | false | false | Should focus on first render |
57+
| length | `number` | `4` | false | How many inputs will be rendered |
58+
| onChange | `function` | `() => null` | false | Function called when the value changes |
59+
| onCompleted | `function` | `() => null` | false | Function called when the value is completed |
60+
| placeholder | `string` | `·` | false | Inputs placeholder |
61+
| value | `string` | `""` | false | Default value |
62+
| type | `'alphanumeric, number'` | `number` | false | Should accepts alphanumeric values or only numbers |
63+
64+
### Custom Styles
65+
66+
Simply override the styles using the following classnames
67+
68+
```css
69+
.ReactInputVerificationCode-container {}
70+
.ReactInputVerificationCode-item {}
71+
```
7172

7273
## License
7374

0 commit comments

Comments
 (0)