
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
react-phone-number-validation
Advanced tools
`React Phone Number Validation` is a React component library that provides a customizable phone input field with a dropdown menu for selecting countries. This component simplifies the process of collecting phone numbers from users while allowing them to e
React Phone Number Validation
is a React component library that provides a customizable phone input field with a dropdown menu for selecting countries. This component simplifies the process of collecting phone numbers from users while allowing them to easily choose their country code.
To test React Phone Number Validation on CodeSandbox, click here.
You can install react-phone-number-validation
via npm or yarn:
npm install react-phone-number-validation
# or
yarn add react-phone-number-validation
Once installed, you can use the PhoneInput
component in your React application:
import React, { useState } from "react";
import PhoneInput from "react-phone-number-validation";
const App = () => {
const [phoneNumber, setPhoneNumber] = useState("");
const handleChange = (value, country) => {
// Handle phone number change
console.log("Phone Number:", value);
console.log("Selected Country:", country);
setPhoneNumber(value);
};
return (
<PhoneInput
value={phoneNumber} // Current value of the phone number input (required)
setValue={setPhoneNumber} // Function to set the value of the phone number input (required)
onChange={handleChange} // Function called when the phone number changes (required)
/>
);
};
export default App;
Prop | Type | Description | Default |
---|---|---|---|
country | String | Set default country (e.g., 'gb' for United Kingdom). | 'af' |
inputClass | String | Custom class for the input element (optional). | |
dropdownClass | String | Custom class for the dropdown element (optional). | |
autoSelectCountry | Boolean | Auto-select country based on user location (optional). | false |
enableSearch | Boolean | Enable country search (optional). | false |
disableDropdown | Boolean | Disable dropdown (optional). | false |
countryCodeEditable | Boolean | Allow user to edit country code (optional). | true |
hideAsterisk | Boolean | Hide asterisk for required fields (optional). | false |
value | String | Input value (required). | |
setValue | Function | Callback function to update input value (required). | |
onChange | Function | Callback function to handle input change (required). | |
dropdownStyle | Object | Custom style for dropdown (optional). | |
searchPlaceholder | String | Search placeholder (optional). | 'Search' |
name | String | Input name (optional). | '' |
required | Boolean | Required field (optional). | false |
searchNotFound | String | Search not found message (optional). | 'No Country Found' |
isValidMessage | String | Validation message (optional). | 'Invalid Phone Number' |
onRender | Function | Callback function to handle render (optional). | (value, country) => console.log(value, country) |
Meta Dev Zone – @meta-dev-zone
FAQs
`React Phone Number Validation` is a React component library that provides a customizable phone input field with a dropdown menu for selecting countries. This component simplifies the process of collecting phone numbers from users while allowing them to e
The npm package react-phone-number-validation receives a total of 19 weekly downloads. As such, react-phone-number-validation popularity was classified as not popular.
We found that react-phone-number-validation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.