
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-phone-input-auto-format
Advanced tools
This is an auto-formatting phone input component.
If an Input component is passed as the inputComponent prop, it will be rendered instead of the default html input which allows easy integration with Styled Components
Also exposes utility functions to normalize and format the phone number.
Pros:

If you wish to use the styling displayed above, check out the demo source
npm install react-phone-input-auto-format --save
import React from "react";
import PhoneInput from "react-phone-input-auto-format";
const onChange = phoneNumber => {
// do something with the phone number
};
const Form = () => {
return <PhoneInput onChange={onChange} />;
};
export default Form;
Also see the demo
import React from "react";
import PhoneInput from "react-phone-input-auto-format";
import styled from "styled-components";
const Input = styled.input`
border: 1px solid blue;
font-size: 2em;
`;
const onChange = phoneNumber => {
// do something with phone number
};
const Form = () => {
return <PhoneInput onChange={onChange} inputComponent={Input} />;
};
export default Form;
Also see the demo and demo source
import React from "react";
import PhoneInput, { format, normalize } from "react-phone-input-auto-format";
const onChange = phoneNumber => {
const formatted = format(phoneNumber); // (123) 456-7890
const normalized = normalize(phoneNumber); // 1234567890
// do something with the formatted or normalized number
};
const Input = () => {
return <PhoneInput onChange={onChange} />;
};
export default Input;
| name | type | description |
|---|---|---|
| onChange | function | Returns the value of the input field |
| inputComponent | React Component | Will be used as the input if given, otherwise will use a default HTML input |
Other properties (not documented) are applied to the root element.
FAQs
Auto formatting phone input React component, US only
The npm package react-phone-input-auto-format receives a total of 292 weekly downloads. As such, react-phone-input-auto-format popularity was classified as not popular.
We found that react-phone-input-auto-format demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.