1.0.29 • Published 1 year ago

react-number-formatter v1.0.29

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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
PropsDescription
getCountryCodeTo get selected country code
formatTo create your own format
defaultCountryTo make a country default selected
onlyCountriesTo filter country options
fixLengthTo limit input length
disabledTo make input and selector disable
fullIsoCodeSets 3 letter ISO Code e.g. "IND", "USA"
searchOptionTo add or remove search bar
registerTo use this input inside react-hook-form
flags: BooleanTo get country code instead of flag
placeholder: StringTo change placeholder
initialFormat: BooleanWhen 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)}
/> 

Screen Recording 2023-05-14 at 2 03 26 PM

You can create your own format.

<NumberFormatter
  format={"+1 (###)-(###)-####"}
  value={number}
  getValue={(n: string) => setNumber(n)}
/> 

Screen_Recording_2023-02-19_at_8_03_19_PM_AdobeExpress

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