1.0.29 • Published 1 year ago
react-number-formatter v1.0.29
react-number-formatter
This React input component automatically formats phone numbers as you type and returns the actual number you entered. 😊
Installation
Run this command in your terminal
npm add react-number-formatter
Props | Description |
---|---|
getCountryCode | To get selected country code |
format | To create your own format |
defaultCountry | To make a country default selected |
onlyCountries | To filter country options |
fixLength | To limit input length |
disabled | To make input and selector disable |
fullIsoCode | Sets 3 letter ISO Code e.g. "IND", "USA" |
searchOption | To add or remove search bar |
register | To use this input inside react-hook-form |
flags: Boolean | To get country code instead of flag |
placeholder: String | To change placeholder |
initialFormat: Boolean | When using this component in editable forms. this function automatically guess the the dial code and formats the number |
Demo with hook form
Normal Usage
import { NumberFormatter } from 'react-number-formatter';
const [number, setNumber] = useState();
//for typescript
const [number, setNumber] = useState<string | number>();
<NumberFormatter
value={number}
initialFormat={true}
getValue={(n: string) => setNumber(n)}
/>
You can create your own format.
<NumberFormatter
format={"+1 (###)-(###)-####"}
value={number}
getValue={(n: string) => setNumber(n)}
/>
1.0.22
1 year ago
1.0.21
1 year ago
1.0.26
1 year ago
1.0.25
1 year ago
1.0.24
1 year ago
1.0.23
1 year ago
1.0.29
1 year ago
1.0.28
1 year ago
1.0.27
1 year ago
1.0.20
2 years ago
1.0.19
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago