1.0.20 • Published 12 months ago

react-number-formatter v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

react-number-formatter

This react input component automatically formats phone numbers inside input and returns the number you actually typed.

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

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 too.

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

Screen_Recording_2023-02-19_at_8_03_19_PM_AdobeExpress

1.0.20

12 months ago

1.0.19

12 months ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago